1 |
Richard Freeman schrieb: |
2 |
> I just noticed that my time was off and after checking the logs I saw |
3 |
> that ntpd was adjusting the time by 5 minutes several times a day for |
4 |
> the last month. |
5 |
> |
6 |
> Searching around I found some hints that disabling apic might help. This |
7 |
> is on a K8V deluxe motherboard and running 2.6.20-r7. Before I disable |
8 |
> apic, will this have any negative effects on the system? This is a |
9 |
> desktop system so I don't really care about power-saving features |
10 |
> (although I'd like to keep cpudyn working if possible). |
11 |
> |
12 |
> I'm also running ivtv (mythtv backend) which apparently can cause clock |
13 |
> skew due to some kind of DMA error, but I'm not seeing that in the logs. |
14 |
> |
15 |
> Any advice? |
16 |
|
17 |
See "man hwclock" |
18 |
|
19 |
... |
20 |
The Adjust Function |
21 |
|
22 |
The Hardware Clock is usually not very accurate. However, much of its |
23 |
inaccuracy is completely predictable - it gains or loses the same amount |
24 |
of time every day. This is called systematic drift. hwclock's "adjust" |
25 |
function lets you make systematic corrections to correct the systematic |
26 |
drift. |
27 |
|
28 |
It works like this: hwclock keeps a file, /etc/adjtime, that keeps some |
29 |
historical information. This is called the adjtime file. |
30 |
|
31 |
Suppose you start with no adjtime file. You issue a hwclock --set |
32 |
command to set the Hardware Clock to the true current time. Hwclock |
33 |
creates the adjtime file and records in it the current time as the last |
34 |
time the clock was calibrated. 5 days later, the clock has gained 10 |
35 |
seconds, so you issue another hwclock --set command to set it back 10 |
36 |
seconds. Hwclock updates the adjtime file to show the current time as |
37 |
the last time the clock was calibrated, and records 2 seconds per day as |
38 |
the systematic drift rate. 24 hours go by, and then you issue a hwclock |
39 |
--adjust command. Hwclock consults the adjtime file and sees that the |
40 |
clock gains 2 seconds per day when left alone and that it has been left |
41 |
alone for exactly one day. So it subtracts 2 seconds from the Hardware |
42 |
Clock. It then records the current time as the last time the clock was |
43 |
adjusted. Another 24 hours goes by and you issue another hwclock |
44 |
--adjust. Hwclock does the same thing: subtracts 2 seconds and updates |
45 |
the adjtime file with the current time as the last time the clock was |
46 |
adjusted. |
47 |
|
48 |
Every time you calibrate (set) the clock (using --set or --systohc ), |
49 |
hwclock recalculates the systematic drift rate based on how long it has |
50 |
been since the last calibration, how long it has been since the last |
51 |
adjustment, what drift rate was assumed in any intervening adjustments, |
52 |
and the amount by which the clock is presently off. |
53 |
|
54 |
A small amount of error creeps in any time hwclock sets the clock, so it |
55 |
refrains from making an adjustment that would be less than 1 second. |
56 |
Later on, when you request an adjustment again, the accumulated drift |
57 |
will be more than a second and hwclock will do the adjustment then. |
58 |
|
59 |
It is good to do a hwclock --adjust just before the hwclock --hctosys at |
60 |
system startup time, and maybe periodically while the system is running |
61 |
via cron. |
62 |
|
63 |
The adjtime file, while named for its historical purpose of controlling |
64 |
adjustments only, actually contains other information for use by hwclock |
65 |
in remembering information from one invocation to the next. |
66 |
|
67 |
The format of the adjtime file is, in ASCII: |
68 |
|
69 |
Line 1: 3 numbers, separated by blanks: 1) systematic drift rate in |
70 |
seconds per day, floating point decimal; 2) Resulting number of seconds |
71 |
since 1969 UTC of most recent adjustment or calibration, decimal |
72 |
integer; 3) zero (for compatibility with clock(8)) as a decimal integer. |
73 |
|
74 |
Line 2: 1 number: Resulting number of seconds since 1969 UTC of most |
75 |
recent calibration. Zero if there has been no calibration yet or it is |
76 |
known that any previous calibration is moot (for example, because the |
77 |
Hardware Clock has been found, since that calibration, not to contain a |
78 |
valid time). This is a decimal integer. |
79 |
|
80 |
Line 3: "UTC" or "LOCAL". Tells whether the Hardware Clock is set to |
81 |
Coordinated Universal Time or local time. You can always override this |
82 |
value with options on the hwclock command line. |
83 |
|
84 |
You can use an adjtime file that was previously used with the clock(8) |
85 |
program with hwclock. |
86 |
... |