[RFD] divecomputer time/date synchronization while downloading dives
Jef Driesen
jef at libdivecomputer.org
Thu Jul 20 01:08:53 PDT 2017
On 19-07-17 22:08, Linus Torvalds wrote:
> Anyway, what this all builds up to is that I'd actually like to just
> set the time automatically when I connect the dive computer to my
> laptop (or my cellphone, for that matter - usually those end up being
> synchronized to the local time quite nicely).
>
> And I just wrote the code for that for the Suunto EON Steel. Patch to
> libdivecomputer attached in case anybody cares (and I was happy to
> realize that it actually uses milliseconds for synchronization, but
> then noticed that it may be just a protocol thing, and the extra
> precision may get thrown away).
>
> But I suspect people will hate that patch because it does that time
> sync thing *unconditionally*. It would be good to have a check-box and
> some way to actually set the "sync time" flag. But for that to happen,
> we'd need not just the UI side, we'd need to have the libdivecomputer
> interface too.
>
> And yes, I know about "configure dive computer" and the "sync time"
> hack there. But it's really an ostc-specific hack, not something that
> can be used in general to synchronize the clock.
>
> Thus the "request for discussion". I'd love to be able to pass in
> flags like this to dc_device_open() or add a sane
> "dc_device_set_feature()" interface or something..
How about turning the ostc specific clock sync function into a standard function
that is part of the dc_device_t interface? Then every backend that supports
setting the time can easily implement it. I'm pretty sure there are more dive
computers where the protocol supports this (e.g. the oceanic software has a time
sync setting), so I see no reason not to support this as a standard feature.
dc_status_t
dc_device_clock (dc_device_t *device, const dc_datetime_t *datetime);
And then it's up to the application to call this function or not. Doing this
kind of stuff automatically from within libdivecomputer is probably a bad idea
(host clock can be wrong, set to a different time zone, etc).
PS: I'm currently traveling and pretty much offline until next week. It's going
to take some more time to answer emails and catch up with everything in my mail box.
Jef
More information about the devel
mailing list