Thread: Time drift
View Single Post
  #1   (View Single Post)  
Old 17th June 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default Time drift

I run a cron job on all my machines at varying times between midnight and 1 am that updates the system clock via NTP. I've noticed that the drift on my machines is usually between 2-4 seconds, which I guess isn't too bad, but when you stop to think about it, if I wasn't updating via NTP every day, then after a month I would be nearly a minute off.

Not to mention running at securelevel 2+ caps time changes at 1 second.

So, is there some sysctl that can be set to tune the clock ticks?

I did a quick google search that didn't yield much too promising (then again I'm on the brink of passing out from lack of sleep). Any help would greatly be appreciated, as I would like to bump up the securelevel to 3 once my firewall rules are in place and thoroughly tested.

sysctl kern.timecounter:
Code:
kern.timecounter.tick: 1
kern.timecounter.choice: TSC(-100) ACPI-fast(1000) i8254(0) dummy(-1000000)
kern.timecounter.hardware: ACPI-fast
kern.timecounter.nsetclock: 4
kern.timecounter.ngetmicrotime: 4239525
kern.timecounter.ngetnanotime: 1
kern.timecounter.ngetbintime: 0
kern.timecounter.ngetmicrouptime: 1846524
kern.timecounter.ngetnanouptime: 1902
kern.timecounter.ngetbinuptime: 18796
kern.timecounter.nmicrotime: 756286
kern.timecounter.nnanotime: 115
kern.timecounter.nbintime: 756427
kern.timecounter.nmicrouptime: 66335
kern.timecounter.nnanouptime: 3
kern.timecounter.nbinuptime: 950632
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.i8254.mask: 65535
kern.timecounter.tc.i8254.counter: 35499
kern.timecounter.tc.i8254.frequency: 1193182
kern.timecounter.tc.i8254.quality: 0
kern.timecounter.tc.ACPI-fast.mask: 16777215
kern.timecounter.tc.ACPI-fast.counter: 3199901
kern.timecounter.tc.ACPI-fast.frequency: 3579545
kern.timecounter.tc.ACPI-fast.quality: 1000
kern.timecounter.tc.TSC.mask: 4294967295
kern.timecounter.tc.TSC.counter: 1817965752
kern.timecounter.tc.TSC.frequency: 1041000000
kern.timecounter.tc.TSC.quality: -100
kern.timecounter.smp_tsc: 0
dmesg | grep Timecounter
Code:
Timecounter "i8254" frequency 1193182 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
Timecounters tick every 1.000 msec
Any further information needed, just ask.

I guess an option could be instead of running the cron job to update the clock once a day, I do it 4 times a day (so the changes should be < 1 second each time). But I'd prefer to fix this little issue.

Also, forgot to mention, don't know if the clock is fast of slow. Here's a sample output:
Code:
17 Jun 00:31:00 ntpdate[66266]: ntpdate 4.2.0-a Tue Jun 10 13:05:26 MST 2008
(1)
17 Jun 00:31:03 ntpdate[66266]: step time server 82.165.177.157 offset
1.870777 sec
Edit: Looking at the dates from the cron mail above, it appears that the clock is running slow (unless if the nptdate command took ~3 seconds to run by itself, but usually if I run it manually it doesn't take anywhere near that long)
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!

Last edited by cajunman4life; 17th June 2008 at 07:46 AM.
Reply With Quote