shithub: riscv

Download patch

ref: c01833286b91b80caf56fd370ccc99060eb86a4a
parent: 5165864dbbdb90e41ef25c0576f5b06c990098d8
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Jun 25 16:28:51 EDT 2013

timesync: reduce the frequency tolerance from half to double the system clock

the frequency tolerance used by timesync was from a 10th to 10 times
the frequency of the system clock! switching a system from tsc to pic
timer changes the system clock frequency from 300MHz to arround 1.8Ghz
on a x200s laptop resulting in time running way too slow or way too fast.

so we change timesync to only accept frequencies from half to double the
system clock which still seems huge, but at least catches the case above
resulting in timesync ignoring the old frequency file.

--- a/sys/src/cmd/aux/timesync.c
+++ b/sys/src/cmd/aux/timesync.c
@@ -288,8 +288,8 @@
 	/* figure out our time interface and initial frequency */
 	inittime();
 	gettime(0, 0, &hz);
-	minhz = hz/10;
-	maxhz = hz*10;
+	minhz = hz / 2;
+	maxhz = hz * 2;
 	myprec = getclockprecision(hz);
 
 	/* convert the accuracy from nanoseconds to ticks */
--