git: 9front

Download patch

ref: 7b829752ebae8feb770f9793d82b250d35c9eac5
parent: 8678b005454a1743c78ab06ea1bb8f8372f84548
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 */
--