Gentoo Archives: gentoo-user

From: Michael Mol <mikemol@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] hwclock <--> sysclock and the ntp-client
Date: Tue, 07 Feb 2012 01:03:41
Message-Id: CA+czFiAhxDN5NObF6ydWqJtsi5EMS6qZM2zdpRp==6NjdsMKrA@mail.gmail.com
In Reply to: Re: [gentoo-user] hwclock <--> sysclock and the ntp-client by meino.cramer@gmx.de
1 On Feb 6, 2012 7:00 PM, <meino.cramer@×××.de> wrote:
2 >
3 > Michael Mol <mikemol@×××××.com> [12-02-06 19:56]:
4 > > On Mon, Feb 6, 2012 at 1:39 PM, <meino.cramer@×××.de> wrote:
5 > > > Michael Mol <mikemol@×××××.com> [12-02-06 19:20]:
6 > > >> On Mon, Feb 6, 2012 at 12:51 PM, <meino.cramer@×××.de> wrote:
7 > > >> > Hi,
8 > > >> >
9 > > >> > to get the correct system time I use ntp-client in the boot
10 process.
11 > > >> > Furthermore in /etc/conf.d/hwclock I set:
12 > > >> >
13 > > >> > # Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also
14 known as
15 > > >> > # Greenwich Mean Time). If that clock is set to the local
16 time, then
17 > > >> > # set CLOCK to "local". Note that if you dual boot with
18 Windows, then
19 > > >> > # you should set it to "local".
20 > > >> > clock="UTC"
21 > > >> >
22 > > >> > # If you want to set the Hardware Clock to the current System
23 Time
24 > > >> > # (software clock) during shutdown, then say "YES" here.
25 > > >> > # You normally don't need to do this if you run a ntp daemon.
26 > > >> > clock_systohc="YES"
27 > > >> >
28 > > >> > # If you want to set the system time to the current hardware
29 clock
30 > > >> > # during bootup, then say "YES" here. You do not need this if
31 you are
32 > > >> > # running a modern kernel with CONFIG_RTC_HCTOSYS set to y.
33 > > >> > # Also, be aware that if you set this to "NO", the system time
34 will
35 > > >> > # never be saved to the hardware clock unless you set
36 > > >> > # clock_systohc="YES" above.
37 > > >> > clock_hctosys="NO"
38 > > >> >
39 > > >> > # If you wish to pass any other arguments to hwclock during
40 bootup,
41 > > >> > # you may do so here. Alpha users may wish to use --arc or
42 --srm here.
43 > > >> > clock_args=""
44 > > >> >
45 > > >> > In the kernel config file I had set:
46 > > >> >
47 > > >> > CONFIG_RTC_HCTOSYS=y
48 > > >> > CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
49 > > >> >
50 > > >> > I would exspect that after a reboot of the system which system
51 time is
52 > > >> > correctly set via ntp-client that the hwclock and system time only
53 > > >> > differ in a small amount of time.
54 > > >> >
55 > > >> > But:
56 > > >> > solfire:/home/mccramer>hwclock
57 > > >> > Mon Feb 6 19:05:11 2012 -0.172569 seconds
58 > > >> > solfire:/home/mccramer>date
59 > > >> > Mon Feb 6 18:49:37 CET 2012
60 > > >> > solfire:/home/mccramer>
61 > > >>
62 > > >> I don't know the CET tz, but I can see that the minutes don't match
63 > > >> up. I assume you rand the two commands within seconds of each other.
64 > > >> Is this true immediately after bootup, or does it take a while to get
65 > > >> that far off? It could be that your hardware clock is drifting, and
66 > > >> the system won't reset it until it goes to shutdown.
67 > > >>
68 > > >> --
69 > > >> :wq
70 > > >>
71 > > >
72 > > > Hi Michael,
73 > > > thank you for your reply.
74 > > > I set the configuration as mentioned above and booted twice with about
75 > > > five minutes wait.
76 > > > The commands were executed within seconds, yes.
77 > > > All hardware clocks drifts, but this is not the problem.
78 > > > The problem is that the hardware clock is not set to the system time
79 > > > in contradiction to what I think the comments in the config are
80 > > > saying.
81 > > >
82 > > > How can I fix that?
83 > >
84 > > I don't really know. Are you sure that rtc0 corresponds to your
85 > > hardware clock device? Does setting "clock_hctosys" to YES have any
86 > > effect?
87 > >
88 > > Is this in some kind of virtual-machine or hypervised environment
89 > > where something may be blocking the OS from setting the hardware
90 > > clock?
91 > >
92 > > --
93 > > :wq
94 > >
95 >
96 > It is set
97 >
98 > lrwxrwxrwx 1 root root 4 2012-02-07 00:52 /dev/rtc -> rtc0
99 > crwxrwx--- 1 root audio 254, 0 2012-02-07 00:52 /dev/rtc0
100 >
101 > and it is the only device of its kind.
102 >
103 > As I wrote I am using ntp_client for setting my system time while
104 > booting up.
105 > So reagrdless wheter I am setting clock_hctosys I am alway getting
106 > the correct system time later in the bootprocess via ntp.
107
108 Sure. My question was more geared toward specifically obtaining information
109 about your hardware clock, which you probed with the hwclock command. You
110 insist your hardware clock isn't being updated, but I have insufficient
111 data to verify that, or even get a feel for the behavior of your system.
112 *Obviously* all hardware clocks drift, but I was wondering if your hardware
113 clock was drifting notably rapidly. I don't know at what interval the
114 hardware clock would normally be updated by the kernel, or what constitutes
115 'continuous' in that context.
116
117 Timestamps along with the commands and for notable events, such as when
118 ntpclient ran during bootup and when the system shut down, would be useful.