[PATCH 2/2] Make dive computer download automatically sync the time

Linus Torvalds torvalds at linux-foundation.org
Sun Aug 20 20:52:43 PDT 2017


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sun, 20 Aug 2017 20:41:29 -0700
Subject: [PATCH 2/2] Make dive computer download automatically sync the time

This needs a button or a checkbox or something.  This unconditional time
sync is a hack.

Not-yet-signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

And this is the patch to use the new 'dc_device_timesync()' at download 
time that should *not* be applied, and needs some UI love to make it 
conditional.

Not that applying it will be disastrous (and will only affect EON Steel 
and the OSTC family of dive computers right now anyway, since I think 
those are the only ones that have a working 'timesync' implementation), 
but it sounded like everybody wanted to make it conditional.

 core/libdivecomputer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 2c5f607d..c610fb67 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -1117,6 +1117,11 @@ const char *do_libdivecomputer_import(device_data_t *data)
 	}
 
 	if (rc == DC_STATUS_SUCCESS) {
+		/* HACK HACK HACK - need some kind of "set device time" checkbox */
+		dc_datetime_t now;
+		dc_datetime_localtime(&now, dc_datetime_now());
+		dc_device_timesync(data->device, &now);
+
 		err = do_device_import(data);
 		/* TODO: Show the logfile to the user on error. */
 		dc_device_close(data->device);
-- 
2.14.0.rc1.2.g4c8247ec3



More information about the subsurface mailing list