]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Use UTI_DiffTimevalsToDouble to calculate theta
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 12 Jun 2013 13:11:33 +0000 (15:11 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 12 Jun 2013 13:30:28 +0000 (15:30 +0200)
ntp_core.c

index 05e58860ec8686efda007ae5031e999027c4a983..6ffd364cbce939abecef6a32f5078a648b8a2731 100644 (file)
@@ -927,8 +927,7 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
     /* Calculate theta.  Following the NTP definition, this is negative
        if we are fast of the remote source. */
     
-    theta = (double) (remote_average.tv_sec - local_average.tv_sec) +
-      (double) (remote_average.tv_usec - local_average.tv_usec) * 1.0e-6;
+    UTI_DiffTimevalsToDouble(&theta, &remote_average, &local_average);
     
     /* We treat the time of the sample as being midway through the local
        measurement period.  An analysis assuming constant relative