time

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



http://slashdot.org/article.pl?sid=00/01/01/0954211&mode=nested&threshold=-1

Linux clock an hour off after Y2K reboot????

      (Score:0) by Anonymous Coward on Saturday January 01,
      @12:39PM EST

      I rebooted my Linux box so I could start my personal
      uptime record attempt (previously 402 days) from
      exactly 1/1/00. Besides, it gives me a chance to toss
      in that PCI sound card and upgrade the network cards
      to 100Base-T. Anyway the box came back up... an hour
      ahead!  WTF? Oh wait, I forgot that using date or
      rdate to set the clock doesn't set the hardware clock
      (which was still on daylight savings time). Set the
      correct date, then run setclock. All is well.  And
      100Base-T doesn't like Cat3 cable. Dang.

===

Subject: Re: Clock loses time.
From: Jan Carlson <janc@iname.com>
Date: Tue, 18 May 1999 16:34:45 -0400


Larry Owens wrote:
> 
>         I've looked, and I can't figure it. I have a redhat 5.2 distribution, and
> a 6.0 dist (cheap bytes) and I can't get the system clock to maintain time
> properly. Every now and then, it will randomly lose four hours. Exactly
> four hours. I can't predict when it will do this, but it's not an everyday
> kind of thing. I don't suspect my hardware, since it's different in both
> cases.
> 
>         What am I doing wrong?

If you dual boot with an OS that puts local time in the
hardware clock, Linux should too.  What you see is consistent
with Windows on local time, and Linux on GMT 
(4 hours different in Ohio, right?).

Log in as root, and run timeconfig to fix.

===

Subject: Re: Clock loses time. 
From: Alan Mead <adm@ipat.com>
Date: Tue, 18 May 1999 16:02:47 -0500


At 02:48 PM 5/18/99 -0400, you wrote:
>
>	I've looked, and I can't figure it. I have a redhat 5.2 distribution, and
>a 6.0 dist (cheap bytes) and I can't get the system clock to maintain time
>properly. Every now and then, it will randomly lose four hours. Exactly
>four hours. I can't predict when it will do this, but it's not an everyday
>kind of thing. I don't suspect my hardware, since it's different in both
>cases. 

If you get a solution, I would love to hear it.  I have problems but I do
suspect the hardware.  So, being lazy, I decided to just syncing system
time to a more authoritative host.  I use rdate in a hourly cron script.
Some folks here recommended a more accurate way but this works fine for me.

[billy@billy billy]$ more /etc/cron.hourly/timesync
#!/bin/sh
 
#the NIST computer is sometimes unreachable... sync first to sparkle
/usr/bin/rdate -s sparkle.soltec.net
#on an hourly basis, sync to the NIST time machine
/usr/bin/rdate -s time.nist.gov


===

Subject: Re: Clock loses time.
From: Chuck Milam <milam@uwosh.edu>
Date: Tue, 18 May 1999 16:07:22 -0500 (CDT)


 
On Tue, 18 May 1999, Larry Owens wrote:

> I've looked, and I can't figure it. I have a redhat 5.2 distribution,
> and a 6.0 dist (cheapbytes) and I can't get the system clock to
> maintain time properly.  Every now and then, it will randomly lose
> four hours. Exactly four hours. I can't predict when it will do this,
> but it's not an everyday kind of thing.

I had this same sort of thing happening to me.  My clock would lose either
6 hours or 5 hours (once we changed to Daylight savings time).  Oddly, it
seemed to coincide with activation of xscreensaver.

My solution was to set my PC hardware clock to GMT, and then set my
timezone to my local timezone.

This has also helped eliminate another TZ-related bug I was having with
Pine.

===

Subject: Re: Clock loses time. 
From: Rewt of all Evil <doli@ibt.com.pl>
Date: Tue, 18 May 1999 23:59:08 +0200 (EEST)


run /usr/sbin/timeconfig and set the appropriate timezone

edit /etc/sysconfig/clock and make sure that utc is false and arc tisfalse
then set the proper time, write the value to cmos (/sbin/clock -w)

reboot and check if it worked

===

Subject: Re: RedHat 6.0 - System cant keep the local time correct...
From: Bill Carlson <wcarlson@vh.org>
Date: Mon, 11 Oct 1999 10:16:18 -0500 (CDT)


On Mon, 11 Oct 1999, William Schwartz wrote:

> Thanks for the reply.
> 
> > Sorry, but I can't help you. Unfortunately, this is just a 'me too' msg.
> > :-(
> 
> Feel the pain...
> 
> > I asked about this when I had just installed RH6.0 and I was told to
> > setup the ntpd service to sync my time with some Internet site(s).
> > Great, in a way. But, I'd really like to understand why the time gets
> > screwed up in the first place. And correct that. Then, but not before,
> > would I like to fine tune the time through the 'net.
> 
> Hmmm. I guess I COULD do this.
> 
> > In my case, it's always a case of five - six hours. Sometimes more, but
> > never more than a day. I have setup GMT on the hardware clock and I have
> > set my timezone correctly (GMT+1 + DST). And I'm running Linux only on
> > this PC.
> 
> well, I checked the time today after runnig all weekend (it was correct
> Friday before I left @ 6pm) it was set to October 5th @ 13:48. So, that is 6
> days + some hours. I havn't seen any kind of pattern.
> 
> > I'm using an ASUS P2B-D motherboard with two processors installed. Any
> > similarity?
> 
> I'm running on a single processor PIII 500 compaq Deskpro. Maybe its some
> process running on this server that is causing the issue... It does not seem
> to happen at a regular time of day. It just "happens".
>


Here's how I handle the time. First, set the BIOS to have localtime rather
than GMT, less headaches if you set the BIOS manually.

The date command updates the system date, it DOES NOT update the BIOS. A
seperate command called clock does that. Now, if you look at the clock man
page, you will see that is can write out localtime or GMT to the BIOS
depending on command line arguments, it defaults to localtime.

I would guess that your BIOS is being updated (or NOT being updated at
all!) with localtime vs GMT time. Check your BIOS clock with  clock -r (
clock -ur for GMT in BIOS) and see if it is right. Everytime you reboot
the machine, the date/time is read from the BIOS, so if it isn't right the
system time won't be write. The system time is probably off each time you
boot the machine. Since you mention 6 hours difference, I would guess you
are both on central time...:)

If you are seeing a timewarp on a running machine (you're sure it has not
rebooted) check for a cron job in /etc/cron.daily or /etc/cron.hourly that
references clock.

Grrr...I was just rooting around on my box, the clock man page is no
longer included. clock is a symlink to hwclock, look at man hwclock.

===

Subject: Re: Setting CMOS date
From: Charles Galpin <cgalpin@lighthouse-software.com>
Date: Mon, 8 Nov 1999 07:46:04 -0500 (EST)


at least on 6.1 there is a utility called setclock that will set the
hardware clock from the system clock. So get your date/time right with
date -s "<right time/date>" and then run setclock.

I found it with 
man -k clock

I just upgraded to 6.1, and it screwed up my time. I thought I had a
pretty standard setup, and would have thought the upgrade would have been
able to preserve my existing setup. All it all though I thought the 6.1
upgrade went pretty smoothly.

hth
charles

On Mon, 8 Nov 1999, Vidiot wrote:

> Is there a way to set the CMOS date chip in a PeeCee motherboard via
> a linux shell command line program?
> 
> If "date" can do it, I don't see an option that enables it to do that.


===

Subject: Re: Setting CMOS date
From: Hal Burgiss <hburgiss@bellsouth.net>
Date: Mon, 8 Nov 1999 07:42:37 -0500


On Mon, Nov 08, 1999 at 04:13:27AM -0600, Vidiot wrote:
> Is there a way to set the CMOS date chip in a PeeCee motherboard via
> a linux shell command line program?
> 
> If "date" can do it, I don't see an option that enables it to do that.

See 'man hwclock'.

===

Subject: Re: Setting CMOS date
From: "Adrian Walters" <howreal@hotmail.com>
Date: Mon, 08 Nov 1999 09:54:38 EST


just type hwclock --set --date=newdate
where newdate is in the format 11/8/99 10:00:00

make sure you use military time. for instance 6 pm today is 18:00:00

so just run
/sbin/hwclock witht the proper arguments and all should be well. let me know 
if this works for you. 

**be sure to reboot so programs that depend on time don't act retarded.**

===


Subject: RE: Setting CMOS date
From: Tom Savage <savaget@vianet.on.ca>
Date: Mon, 08 Nov 1999 11:21:16 -0500 (EST)


Try this while  connected to internet:
(I got this a few months back on this list)

 rdate -s ben.cs.wisc.edu;/usr/sbin/setclock

===





Subject: Re: Can Linux tell time? (6.0)
From: Janine Sisk <janine@furfly.net>
Date: Sat, 05 Jun 1999 22:57:11 -0700


I finally tried the advice people gave me to sync up my date and
clock (I've been away for a couple of days). First I tried setting
the date and then using "setclock" to sync up the hardware clock,
but that did something funky instead:

[root@starbuck /root]# hwclock
Sat Jun  5 21:51:43 1999  -0.409822 seconds
[root@starbuck /root]# date --set "10:53 pm"
Sat Jun  5 22:53:00 PDT 1999
[root@starbuck /root]# setclock
[root@starbuck /root]# hwclock
Sun Jun  6 05:53:08 1999  -0.689247 seconds

Eh?

So I tried Brian's advice:

Brian wrote:
> you need to write the time to the hwclock.  Typically we do something
> like:
> 
> 00 00 * * *     /usr/bin/rdate -s time.nist.gov
> 02 00 * * *     /sbin/clock -w

That worked.  Thanks Brian!



===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu