[sf-lug] Linux and the new DST

Jim Stockford jim.stockford at gmail.com
Thu Mar 8 09:17:18 PST 2007


<GEEK_ALERT> the following contains commands,
including making a cron job that could stand a reality check.
-----------------------------------------------------

I've been working on this date and time stuff a bit:

tzdata-2006m-3.el4.noarch.rpm for RHEL systems contains
updated data to account for the new USA daylight savings time.
   You can get it from
http://rpm.pbone.net/index.php3/stat/4/idpl/3649130/com/tzdata-2006m-3.el4.noarch.rpm.html
   I don't know what's the equivalent for debian-based systems.
without it your systems will not adjust for this Sunday's
daylight savings change--they'll do last year's thing. Note
the root prompt, and note the command assumes you've
downloaded the file in the current directory.
# rpm -Uvh ./tzdata-2006m-3.el4.noarch.rpm
# rpm -qa | grep tzdata  # do this if you want to verify tzdata is installed


   RHEL systems come with the rdate command in the /usr/bin/
directory. This'll update your system time if you use the syntax
# rdate -s <timeserver>
for example,
# rdate -s time-a.nist.gov
   (note the root prompt.) (there are timeservers other than time-a.nist.gov)

   put this in a cron job to automate regular time synching--
note after crontab comes up you have to use the  G  command to jump
to the bottom of the file then the  i  command to insert text.
# crontab -e  # brings up a vi editor ready to edit the system crontab file
i
* 1 * * * /usr/bin/rdate -s <timeserver>
<ESC> :wq
 (hit the escape key to put vi in command mode then type
the colon ( : ) character followed by w and q to write and quit.)
   At 1 AM your system will update the system clock.

   There are two clocks, the system clock in RAM and a hardware
clock that is maintained (on commodity Intel boxes) by BIOS in
CMOS memory. Whenever you shutdown normally part of the
shutdown process syncs the hardware clock to the system clock.
Whenever you boot up, the boot process reads the hardware clock
into the system clock.
   There is such a thing as "drift", meaning that the electronics and
data do not do a perfect job of keeping time: over many hours the
system and hardware clocks vary from exact time maintained by
the atomic clocks for the world (accessible via time-a.nist.gov).
Note that the system and hardware clocks drift independently.
   If you rip the power cord, there's no normal shutdown and no
syncing the hardware clock to the system clock. The subsequent
boot process reads whatever value of the hardware clock into the
system clock.
   You can control syncing the hardware clock to the system clock
with the command
# /sbin/hwclock --systohc
   I think--my cron skills are weak--the following will work
 note after crontab comes up you have to use the  G  command to jump
to the bottom of the file then the  i  command to insert text.
# crontab -e
G i
 5 1 * * * /sbin/hwclock --systohc
 <ESC> :wq
(hit the escape key to put vi in command mode then type
the colon ( : ) character followed by w and q to write and quit.)
   At five minutes after 1 AM your system will sync the
hardware clock to the system clock. If the box does lose
power, after it comes back up, it'll use hardware clock time
that won't be very far off, and the system will be back on
realtime after 1 AM.


On 3/7/07, Rick Moen <rick at linuxmafia.com> wrote:
>
> Quoting Jason Turner (jturner at nonzerosums.org):
>
> > http://www.linux-watch.com/news/NS6300294422.html
> >
> > Not a must read, but it casts a bit of light on how Linux systems
> > keep time(and provides a method for confirming/updating your system
> > config).
>
> If you were a _Linux Gazette_ reader, you would have seen this on March
> 1st:
>
> http://linuxgazette.net/136/lg_tips.html
>
> --
> Cheers,             We write precisely            We say exactly
> Rick Moen           Since such is our habit in    How to do a thing or how
> rick at linuxmafia.com Talking to machines;          Every detail works.
> Excerpt from Prof. Touretzky's decss-haiku.txt @
> http://www.cs.cmu.edu/~dst/
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxmafia.com/pipermail/sf-lug/attachments/20070308/5255cac4/attachment.html>


More information about the sf-lug mailing list