[chrony] fix delta calculation with extreme frequency offsets

Miroslav Lichvar mlichvar at fedoraproject.org
Tue Mar 12 17:15:30 UTC 2013


commit 7b707a5bb09d362dece6dae7a69cde7da7eda278
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Tue Mar 12 18:06:38 2013 +0100

    fix delta calculation with extreme frequency offsets

 chrony-delta.patch |   24 ++++++++++++++++++++++++
 chrony.spec        |    2 ++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/chrony-delta.patch b/chrony-delta.patch
new file mode 100644
index 0000000..2f82fd8
--- /dev/null
+++ b/chrony-delta.patch
@@ -0,0 +1,24 @@
+commit 0bb772c575b3842c38e6a58591ecea94449e9bae
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date:   Fri Mar 8 13:54:10 2013 +0100
+
+    Fix delta calculation with extreme frequency offsets
+    
+    This should prevent chronyd from getting stuck and refusing new samples
+    due to failing test4 when the current measured frequency offset is close
+    to 1.0. That can happen when the system clock is stepped forward behind
+    chronyd's back.
+
+diff --git a/ntp_core.c b/ntp_core.c
+index 0fb93e1..be9f613 100644
+--- a/ntp_core.c
++++ b/ntp_core.c
+@@ -793,7 +793,7 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
+        assuming worst case frequency error between us and the other
+        source */
+     
+-    delta = local_interval - remote_interval / (1.0 - source_freq_lo);
++    delta = local_interval - remote_interval * (1.0 + source_freq_lo);
+     
+     /* Calculate theta.  Following the NTP definition, this is negative
+        if we are fast of the remote source. */
diff --git a/chrony.spec b/chrony.spec
index 6a9e017..9330440 100644
--- a/chrony.spec
+++ b/chrony.spec
@@ -16,6 +16,7 @@ Source7:        chrony.nm-dispatcher
 Source8:        chrony.dhclient
 Source9:        chrony-wait.service
 %{?gitpatch:Patch0: chrony-%{version}%{?prerelease}-%{gitpatch}.patch.gz}
+Patch1:         chrony-delta.patch
 
 BuildRequires:  libcap-devel libedit-devel nss-devel pps-tools-devel bison texinfo
 
@@ -39,6 +40,7 @@ clocks, system real-time clock or manual input as time references.
 %prep
 %setup -q -n %{name}-%{version}%{?prerelease}
 %{?gitpatch:%patch0 -p1}
+%patch1 -p1 -b .delta
 
 %{?gitpatch: echo %{version}-%{gitpatch} > version.txt}
 


More information about the scm-commits mailing list