]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Use nanoseconds in timevals in cmdmon protocol
authorMiroslav Lichvar <mlichvar@redhat.com>
Sat, 12 Dec 2009 15:44:38 +0000 (16:44 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Sat, 12 Dec 2009 15:44:38 +0000 (16:44 +0100)
candm.h
util.c

diff --git a/candm.h b/candm.h
index 7eb604273907b6af145e0530a44ac3937c8e01fb..9f44808098494b857b3806e950003ca201042fa9 100644 (file)
--- a/candm.h
+++ b/candm.h
@@ -96,7 +96,7 @@
 typedef struct {
   uint32_t tv_sec_high;
   uint32_t tv_sec_low;
-  uint32_t tv_usec;
+  uint32_t tv_nsec;
 } Timeval;
 
 /* This is used in tv_sec_high for 32-bit timestamps */
diff --git a/util.c b/util.c
index 199733be343de4ea9bec2ec1371da9314e31349b..7ee93b8c7c8294a3962010ea1b76a857c387d6e7 100644 (file)
--- a/util.c
+++ b/util.c
@@ -493,7 +493,7 @@ UTI_TimevalNetworkToHost(Timeval *src, struct timeval *dest)
 {
   uint32_t sec_low, sec_high;
 
-  dest->tv_usec = ntohl(src->tv_usec);
+  dest->tv_usec = ntohl(src->tv_nsec) / 1000;
   sec_high = ntohl(src->tv_sec_high);
   sec_low = ntohl(src->tv_sec_low);
 
@@ -514,7 +514,7 @@ UTI_TimevalNetworkToHost(Timeval *src, struct timeval *dest)
 void
 UTI_TimevalHostToNetwork(struct timeval *src, Timeval *dest)
 {
-  dest->tv_usec = htonl(src->tv_usec);
+  dest->tv_nsec = htonl(src->tv_usec * 1000);
   if (sizeof (time_t) > 4)
     dest->tv_sec_high = htonl(src->tv_sec >> 16 >> 16);
   else