From b392a49045d5050c8a0b83793aa18d1747012c94 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 1 Feb 2010 21:20:11 +0000 Subject: [PATCH] Update the code to use the new datetime support. --- src/device.h | 1 + src/reefnet_sensus.c | 7 +++---- src/reefnet_sensuspro.c | 7 +++---- src/reefnet_sensusultra.c | 7 +++---- src/uwatec_aladin.c | 7 +++---- src/uwatec_memomouse.c | 7 +++---- src/uwatec_smart.c | 7 +++---- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/device.h b/src/device.h index d375d4a..b22fd73 100644 --- a/src/device.h +++ b/src/device.h @@ -23,6 +23,7 @@ #define DEVICE_H #include "buffer.h" +#include "datetime.h" #ifdef __cplusplus extern "C" { diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index a4cc8c5..f6941dd 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -22,7 +22,6 @@ #include // memcmp, memcpy #include // malloc, free #include // assert -#include // time #include "device-private.h" #include "reefnet_sensus.h" @@ -43,7 +42,7 @@ typedef struct reefnet_sensus_device_t { unsigned int waiting; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } reefnet_sensus_device_t; static device_status_t reefnet_sensus_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size); @@ -110,7 +109,7 @@ reefnet_sensus_device_open (device_t **out, const char* name) device->port = NULL; device->waiting = 0; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; memset (device->handshake, 0, sizeof (device->handshake)); @@ -272,7 +271,7 @@ reefnet_sensus_handshake (reefnet_sensus_device_t *device) #endif // Store the clock calibration values. - device->systime = time (NULL); + device->systime = dc_datetime_now (); device->devtime = array_uint32_le (handshake + 8); // Store the handshake packet. diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index 6542c65..768e932 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -21,7 +21,6 @@ #include // memcmp, memcpy #include // malloc, free -#include // time #include "device-private.h" #include "reefnet_sensuspro.h" @@ -41,7 +40,7 @@ typedef struct reefnet_sensuspro_device_t { unsigned char handshake[REEFNET_SENSUSPRO_HANDSHAKE_SIZE]; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } reefnet_sensuspro_device_t; static device_status_t reefnet_sensuspro_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size); @@ -89,7 +88,7 @@ reefnet_sensuspro_device_open (device_t **out, const char* name) // Set the default values. device->port = NULL; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; memset (device->handshake, 0, sizeof (device->handshake)); @@ -241,7 +240,7 @@ reefnet_sensuspro_handshake (reefnet_sensuspro_device_t *device) #endif // Store the clock calibration values. - device->systime = time (NULL); + device->systime = dc_datetime_now (); device->devtime = array_uint32_le (handshake + 6); // Store the handshake packet. diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index f1ebf9b..39eea3a 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -22,7 +22,6 @@ #include // memcmp, memcpy #include // malloc, free #include // assert -#include // time #include "device-private.h" #include "reefnet_sensusultra.h" @@ -47,7 +46,7 @@ typedef struct reefnet_sensusultra_device_t { unsigned int maxretries; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } reefnet_sensusultra_device_t; static device_status_t reefnet_sensusultra_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size); @@ -96,7 +95,7 @@ reefnet_sensusultra_device_open (device_t **out, const char* name) device->port = NULL; device->maxretries = 2; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; memset (device->handshake, 0, sizeof (device->handshake)); @@ -346,7 +345,7 @@ reefnet_sensusultra_handshake (reefnet_sensusultra_device_t *device) #endif // Store the clock calibration values. - device->systime = time (NULL); + device->systime = dc_datetime_now (); device->devtime = array_uint32_le (handshake + 4); // Store the handshake packet. diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index 6d08f91..d6a1c93 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -21,7 +21,6 @@ #include // malloc, free #include // memcpy -#include // time #include // assert #include "device-private.h" @@ -49,7 +48,7 @@ typedef struct uwatec_aladin_device_t { struct serial *port; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } uwatec_aladin_device_t ; static device_status_t uwatec_aladin_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size); @@ -97,7 +96,7 @@ uwatec_aladin_device_open (device_t **out, const char* name) // Set the default values. device->port = NULL; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; // Open the device. @@ -233,7 +232,7 @@ uwatec_aladin_device_dump (device_t *abstract, dc_buffer_t *buffer) } // Fetch the current system time. - time_t now = time (NULL); + dc_ticks_t now = dc_datetime_now (); // Update and emit a progress event. progress.current += 4; diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index 5b6c197..c78c315 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -22,7 +22,6 @@ #include // memcmp, memcpy #include // malloc, free #include // assert -#include // time #include "device-private.h" #include "uwatec_memomouse.h" @@ -46,7 +45,7 @@ typedef struct uwatec_memomouse_device_t { struct serial *port; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } uwatec_memomouse_device_t; static device_status_t uwatec_memomouse_device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size); @@ -94,7 +93,7 @@ uwatec_memomouse_device_open (device_t **out, const char* name) // Set the default values. device->port = NULL; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; // Open the device. @@ -427,7 +426,7 @@ uwatec_memomouse_dump_internal (uwatec_memomouse_device_t *device, dc_buffer_t * } // Fetch the current system time. - time_t now = time (NULL); + dc_ticks_t now = dc_datetime_now (); // Read the data packet. rc = uwatec_memomouse_read_packet_inner (device, buffer, &progress); diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 137f56a..24a9082 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -21,7 +21,6 @@ #include // malloc, free #include // strncmp, strstr -#include // time, strftime #include "device-private.h" #include "uwatec_smart.h" @@ -40,7 +39,7 @@ typedef struct uwatec_smart_device_t { unsigned int address; unsigned int timestamp; unsigned int devtime; - time_t systime; + dc_ticks_t systime; } uwatec_smart_device_t; static device_status_t uwatec_smart_device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size); @@ -167,7 +166,7 @@ uwatec_smart_device_open (device_t **out) device->socket = NULL; device->address = 0; device->timestamp = 0; - device->systime = (time_t) -1; + device->systime = (dc_ticks_t) -1; device->devtime = 0; irda_init (); @@ -335,7 +334,7 @@ uwatec_smart_device_dump (device_t *abstract, dc_buffer_t *buffer) return rc; // Store the clock calibration values. - device->systime = time (NULL); + device->systime = dc_datetime_now (); device->devtime = array_uint32_le (version + 5); // Update and emit a progress event.