Re: [SLE] Setting time

From: Marcos Vinicius Lazarini (lazarini_at_nics.unicamp.br)
Date: 09/18/04

  • Next message: Rich3800_at_aol.com: "[SLE] Wiegand protocol under linux"
    Date: Sat, 18 Sep 2004 00:13:58 -0300
    To: suse-linux-e@suse.com
    
    

    Sjoerd Hiemstra wrote:
    >
    > Adjusting the KDE clock is rather self-explaining, but here's a good
    > old-fashioned command line version: ;-)
    >
    > 'su' to root
    > delete /etc/adjtime
    > date 09011500 (as an example)
    > hwclock --systohc
    >
    > This creates a new /etc/adjtime file.
    > A week or so later do, again as root:
    >
    > date 09081500 (as an example)
    > hwclock --systohc
    >
    > hwclock now calculates how much your clock is running too fast or too
    > slow, and stores this information in /etc/adjtime.
    > After this, each time you are running, as root,
    >
    > hwclock --adjust
    >
    > the time is adjusted according to this information.
    > You could have this command executed automatically on startup, or make
    > it a cron job.
    > More info: man hwclock.
    >
    > SH

    I was trying to fix a clock systematic drift in an old 486 running debian
    stable, and found this interesting text about hwclock:
    ----------
    File: /usr/share/doc/util-linux/README.Debian.hwclock.gz
    ....
    Issues with hwclock --adjust:

    hwclock has a facility to try to correct for systematic drift in the
    hardware clock, accessed by hwclock --adjust. This facility is *dangerous*
    because it has a severe drawback: it assumes that no program other than
    hwclock --systohc will ever be used to change the hardware clock.

    This assumption is often false, as many common utilities such as ntp,
    chrony, as well as your computer's System Setup BIOS program, and
    any other OS you have in your machine will change the clock.

    Also, if hwclock --adjust is used, one must make sure the drift file
    (/etc/adjtime) is deleted every time the system clock is set to a very
    different value (even if you're using hwclock itself to do it!), or the
    drift computation might become invalid and cause the hardware clock to be
    incorrectly set the next time hwclock --adjust is used.

    hwclock currently does not perform any sort of sanity checks in the values
    it uses to compute the drift file, and will corrupt your clock time by
    potentially very large amounts if anything goes wrong.

    Don't use the hwclock --adjust facility, refer to alternate (and much safer)
    programs such as ntp or chrony if you need precision timekeeping.
    ----------

    So, if you're running a server, on all the time, probably hwclock will work
    fine. Otherwise, better choose anoter way to keep your clock in sync.

    --
    Marcos Lazarini
    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: Rich3800_at_aol.com: "[SLE] Wiegand protocol under linux"

    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: [opensuse] chrony and hwclock
      ... by hwclock, #2 by ntp. ... the drift of the system clock. ... and its drift is corrected by NTP. ...
      (SuSE)
    • Re: Changing time, Ubuntu 10.04 Live USB
      ... I meant a live USB-stick all the way. ... Currently found out i had to change etc/default/rcS, a it said UTC=yes, changing it to no seems to give me persistent right clock. ... I run sudo hwclock, output -> 22.06 ... system time" and it corrects ...
      (Ubuntu)
    • Re: [opensuse] adjtime in openSUSE 11.2
      ... My system clock tends to stray ... Since I run ntpd I don't worry about the hardware clock. ... HWCLOCK it says ... The Adjust Function ...
      (SuSE)
    • Re: incorrect times displayed
      ... (hwclock should bypass /dev/rtc when called like that, ... to /etc/default/rcS, rebooting, and running either of these ... The hardware clock keeps track of time while your computer is off. ...
      (Debian-User)