From: Miroslav Lichvar Date: Wed, 12 Jun 2013 13:11:33 +0000 (+0200) Subject: Use UTI_DiffTimevalsToDouble to calculate theta X-Git-Tag: 1.28-pre1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96668318189d4e5967d130e02a5a79ab82b48192;p=thirdparty%2Fchrony.git Use UTI_DiffTimevalsToDouble to calculate theta --- diff --git a/ntp_core.c b/ntp_core.c index 05e58860..6ffd364c 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -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