]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: cook SO_TIMESTAMP timestamp
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Jun 2014 14:46:15 +0000 (16:46 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Jun 2014 14:58:41 +0000 (16:58 +0200)
This is a partial revert of 8aa9eb19c826f3ea4a9c2ce5e3a71b74aeeb99d0.
With the new generic driver cooking is cheap and it should be slighly
more accurate than reusing offset correction from the scheduler
timestamps.

ntp_io.c

index f84becc5259b260ab1a1e72b38385f88ae09af54..b9515f6afbbafc0418d2b7ad1bdce1e752203855 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -472,7 +472,7 @@ read_from_socket(void *anything)
   ReceiveBuffer message;
   union sockaddr_in46 where_from;
   unsigned int flags = 0;
-  struct timeval now, now_raw;
+  struct timeval now;
   double now_err;
   NTP_Remote_Address remote_addr;
   NTP_Local_Address local_addr;
@@ -483,7 +483,7 @@ read_from_socket(void *anything)
 
   assert(initialised);
 
-  SCH_GetLastEventTime(&now, &now_err, &now_raw);
+  SCH_GetLastEventTime(&now, &now_err, NULL);
 
   iov.iov_base = message.arbitrary;
   iov.iov_len = sizeof(message);
@@ -554,9 +554,7 @@ read_from_socket(void *anything)
         struct timeval tv;
 
         memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv));
-
-        /* This should be more accurate than LCL_CookTime(&now_raw,...) */
-        UTI_AddDiffToTimeval(&now, &now_raw, &tv, &now);
+        LCL_CookTime(&tv, &now, &now_err);
       }
 #endif
     }