Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] hwclock <--> sysclock and the ntp-client Michael Mol <mikemol@×××××.com>