Re: Date and Clock differ by 10 seconds

From: prg (rdgentry1_at_cablelynx.com)
Date: 05/12/05


Date: 12 May 2005 08:48:31 -0700


Jeremy Billones wrote:
> $ /bin/date; /sbin/clock
> Thu May 12 12:51:10 GMT 2005
> Thu 12 May 2005 12:51:22 PM GMT -0.676119 seconds
> $
>
> Does anyone have any idea why those two commands would return
different
> results? (No, it doesn't take 12 seconds to process :)

date returns the kernel's system time/date.

clock returns the value of the RTC/CMOS/BIOS/hardware clock's
date/time.

On most (?) systems clock is a link to hwclock.

This large time difference suggests that the RTC is not being adjusted
to remain reasonably synched with the kernel's system clock. Should
"normally" be within a second or two.

You'll have to look at how your system scripts synch the two clocks.
Many systems write the system time to RTC on shutdown or by running
ntpd or a cron that writes to RTC periodically.

But systems/setups vary and getting it wrong can really foul things up,
so be sure to learn what your system needs. Also check:

$ man hwclock
$ man adjtimex

hth,
prg
email above disabled



Relevant Pages

  • Re: rtc: how should I handle an invalid state?
    ... Which version of hwclock? ... Using /dev interface to clock. ... Assuming hardware clock is kept in local time. ... Some RTC drivers do this themselves: ...
    (Linux-Kernel)
  • Re: ntp and hwclock
    ... I have set up clock in my Ericsson mobile phone more than 3 years ... Maybe the new RTC class lets one change ... |kernel will write the time back to the CMOS clock every 11 minutes. ...
    (Debian-User)
  • Re: Time is going very much off all the time
    ... cumulative so eventually the clock will loose more and more time. ... used during running linux after startup. ... That was the timeer interrupt on DOS. ... That has nothing to do with the rtc. ...
    (alt.os.linux.suse)
  • Re: [patch 02/23] GTOD: persistent clock support, core
    ... This is an arch specific ... defined battery backed clock. ... RTC driver, which doesn't cover 100% of the arch/platforms supported. ... RTC resume: [set xtime] ...
    (Linux-Kernel)
  • Re: Reading the RTC
    ... then writes that date to the RTC. ... For comparison the older hwclock from util-linux-ng 2.13 gave results ... Using /dev/rtc interface to clock. ... Assuming hardware clock is kept in UTC time. ...
    (comp.protocols.time.ntp)