Mailinglist Archive: opensuse (2912 mails)

< Previous Next >
Re: [SLE] Time synch problem
  • From: "B. Stia" <usr@xxxxxxxxxxx>
  • Date: Wed, 9 Feb 2005 21:48:02 -0500
  • Message-id: <200502092148.02868.usr@xxxxxxxxxxx>
On Wednesday 09 July 2003 19:31, (A long time ago) Carlos E. R. wrote:

..........<snipped some>..........
> Or, you may have a temporary network connection, like I do; I will
> explain this in some detail.

Please do, I have been fooling with this for months now, off and on, and
have yet to make this work successfully.
> We can adjust the clock to "internet" time, once, sometime after we
> connect to internet. This, apparently, can be done with the daemon,
> using some option I don't fully understand. Or we can use ntpdate - a
> program which is to disappear some time in the future, but that I
> use, and SuSE uses as well in its own script.

ntpdate is still with us. I invoke it manually as root every once in
awhile to update my time,
> For this, we can simply call "/etc/init.d/xntpd ntptimeset" - and
> assume that when "ntpdate" finally disappears SuSE will adjust the
> script appropriately ;-)

So far, so good :-)
> Of course, /etc/ntp.conf has to be configured; at least, it must have
> a list of servers:
> server IP_address
> server name_address

This is what I normally invoke manually: ntpdate
and then I do a hwclock --systohc

And that would go where? In this line found about half way down the
# server mode 5 prefer

> This is sufficient for "xntpd ntptimeset" to work; just leave the
> rest of the config at the default values.
> Ok, so when is the appropriate time to make this time adjust? Well,
> ideally, during system boot-up, after network connection is
> established. This is done properly by the service xntpd, if enabled.
> The SuSE script "/etc/init.d/xntpd start" does first a clock set
> using ntpdate, if the variable XNTPD_INITIAL_NTPDATE is set to
> "AUTO". Then, it starts the daemon to keep time synchronized.

OK, it does that but is based on what exists at that time though,
right ? and would be updated at the next boot-up for the adjusted time,
right ? And that would be accomplished via the dial-up connection as
per below.
> And, if our network connection is not permanent? Then, the script
> "/etc/ppp/poll.tcpip", which is called from "/etc/ppp/ip-up", will
> adjust the clock first thing: assuming we have some servers
> configured, it will be done every time we connect to internet with
> the modem. I do it differently, only once every five times, and I
> also update the hwclock.

As per what you do. I dial up, download my mail or whatever, sign off
and then not dial up again until needed. Maybe 5 to 20 minutes at a
time. There may be times where I do this 4 or 5 time during one session
of several hours. And, how do you update the hwclock, from the same
script/command ??

This is what is in the ip-up script.

[ "$RUN_POLL_TCPIP" = "no" ] && return

/etc/ppp/poll.tcpip | logger -p security.notice -t poll.tcpip
> The danger of this method is that the clock might suddenly go forward
> or backward a bit (seconds or hours, it depends): not very nice on a
> *nix system, but we can not avoid it.

Hey, that is the way it is !!
> More details to be aware of: what happens to the hardware or CMOS
> clock?
> Well, the script "/etc/init.d/boot.clock" (read it, it is documented)
> does this sequence of things (using the command "hwclock") before
> starting system services:
> - Create if it doesn't exist, the file "/etc/adjtime"

Have an adjtime

> - Adjust hardware clock (CMOS) for known drift during the time the
> computer has been off; this depends on the previous file to work.
> - Copy CMOS clock (hardware) to system time (CPU and OS
> maintained).

> After this, the system goes fully up, and maybe, the clock is
> adjusted from the internet or by hand (danger!). But (and this is
> very different than windows) the CPU maintained clock has to be
> copied back to the CMOS, because the kernel doesn't do it. SuSE does
> it in the script "/etc/init.d/halt" that copies system time to
> hardware time just before power off. Me, I prefer to do it just after
> I adjust to network time, inside "ip-up.local", like this:

Don't have an ip-up.local file, and ip-up says "don't edit". Does it
make a difference ? Either is fine by me unless there is some specific
> /usr/sbin/rcxntpd ntptimeset
> /sbin/hwclock --systohc
> More things to be aware of: a common mistake is manually adjusting
> the system clock from kde control center (for example), and not
> updating the hwclock at the same time: the drift adjust algorithm of
> hwclock thinks that the CMOS clock is fast or slow by the same amount
> you adjusted the clock, and the next boot it will adjust the time by
> several hours... The solution is to delete "/etc/adjtime" and call
> "/sbin/hwclock --systohc" just then (documented on the SuSE sdb).

I never adust the time manually. Always call ntpdate and hwclock.

Your explanation was very enlightening re: how the whole time thing
works. That is good and adds to our knowledge. However, it is still not
clear to me as to the way to adjust the time when I go on-line and keep
the system accurate to a reasonable degree.

Would appreciate a step-by-step saying put this line here and that line

Bob S.

< Previous Next >
Follow Ups