From: Miroslav Lichvar Date: Mon, 3 Jun 2013 09:34:15 +0000 (+0200) Subject: Slew only non-zero local timestamps in ntp core X-Git-Tag: 1.28-pre1~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afceb9d24e855981b6fa5f7d4c7442e5f0caa5d6;p=thirdparty%2Fchrony.git Slew only non-zero local timestamps in ntp core --- diff --git a/ntp_core.c b/ntp_core.c index eac5a19f..e9ef711c 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1513,13 +1513,15 @@ NCR_SlewTimes(NCR_Instance inst, struct timeval *when, double dfreq, double doff struct timeval prev; double delta; prev = inst->local_rx; - UTI_AdjustTimeval(&inst->local_rx, when, &inst->local_rx, &delta, dfreq, doffset); + if (inst->local_rx.tv_sec || inst->local_rx.tv_usec) + UTI_AdjustTimeval(&inst->local_rx, when, &inst->local_rx, &delta, dfreq, doffset); #ifdef TRACEON LOG(LOGS_INFO, LOGF_NtpCore, "rx prev=[%s] new=[%s]", UTI_TimevalToString(&prev), UTI_TimevalToString(&inst->local_rx)); #endif prev = inst->local_tx; - UTI_AdjustTimeval(&inst->local_tx, when, &inst->local_tx, &delta, dfreq, doffset); + if (inst->local_tx.tv_sec || inst->local_tx.tv_usec) + UTI_AdjustTimeval(&inst->local_tx, when, &inst->local_tx, &delta, dfreq, doffset); #ifdef TRACEON LOG(LOGS_INFO, LOGF_NtpCore, "tx prev=[%s] new=[%s]", UTI_TimevalToString(&prev), UTI_TimevalToString(&inst->local_tx));