Linux and correct date/time command

Linux and correct date/time command

Post by Jean-Yves Sim » Wed, 04 Dec 1996 04:00:00



Hi,
I am having a strange problem with 2 commands: date and clock.
When I installed Linux the first time from redhat 4 , I think
I choose the localtime to be US/Central (I'm in Houston).
However when I use the date command, I could see that in fact
I was in the EST timezone. So after a while, I discover that
I have to change the link in /etc/localtime to point to
<path>/CST (Right now I cannot remember the path but I am
sure the linke work as I can more on localtime and get
something). The problem with that is that the time reported
by the date command is now one hour off. Strangely enough,
the time printed by the clock command is exact.
Example:
%date
Mon Dec  2 18:02:09 CST 1996
%clock
19:02:09

I read the man page but that didn't help me.
Anyone has a solution for this ? I must be overlooking
something pretty basic here.

Thanks in advance.

--

 
 
 

Linux and correct date/time command

Post by Mats Andtbac » Wed, 04 Dec 1996 04:00:00



[...]

Quote:>something). The problem with that is that the time reported
>by the date command is now one hour off. Strangely enough,
>the time printed by the clock command is exact.

date(1) gets your system date/time, i.e. it asks the Linux kernel.
clock(1) gets the hardware time, that is it asks the CMOS clock.
probably you're seeing some weird daylight savings time conflict.
--
        "...Everybody got this broken feeling
         like their father or their dog just died..."
                                                        - Leonard Cohen

 
 
 

Linux and correct date/time command

Post by Jean-Yves Sim » Thu, 05 Dec 1996 04:00:00



: [...]
: >something). The problem with that is that the time reported
: >by the date command is now one hour off. Strangely enough,
: >the time printed by the clock command is exact.

: date(1) gets your system date/time, i.e. it asks the Linux kernel.
: clock(1) gets the hardware time, that is it asks the CMOS clock.
: probably you're seeing some weird daylight savings time conflict.

Thanks for your answer. Can I get date and clock to report the
same information ? How do I save the daylight savings time conflict ?

: --
:         "...Everybody got this broken feeling
:          like their father or their dog just died..."
:                                                         - Leonard Cohen

--

 
 
 

Linux and correct date/time command

Post by Jeremy Mathe » Fri, 06 Dec 1996 04:00:00




>I am having a strange problem with 2 commands: date and clock.  When
>I installed Linux the first time from redhat 4 , I think I choose
>the localtime to be US/Central (I'm in Houston).  However when I
>use the date command, I could see that in fact I was in the EST
>timezone. So after a while, I discover that I have to change the link
>in /etc/localtime to point to <path>/CST (Right now I cannot remember
>the path but I am sure the linke work as I can more on localtime and
>get something). The problem with that is that the time reported by the
>date command is now one hour off. Strangely enough, the time printed by
>the clock command is exact.

I've noticed this same thing (I am in Chicago - same timezone).  Maybe a
common thread.

Anyway, what I do is just put this line in /etc/rc.d/rc.local - it fixes
everything:

        rdate time_a.timefreq.bldrdoc.gov

************************************************************************
You blidderin' dimwit, Olivia!
How can you leadin' a heart after I's makin' Lightner Double?


          hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer

 
 
 

Linux and correct date/time command

Post by Matthew Hixs » Sat, 07 Dec 1996 04:00:00



>Hi,
>I am having a strange problem with 2 commands: date and clock.
>When I installed Linux the first time from redhat 4 , I think
>I choose the localtime to be US/Central (I'm in Houston).
>However when I use the date command, I could see that in fact
>I was in the EST timezone. So after a while, I discover that
>I have to change the link in /etc/localtime to point to
><path>/CST (Right now I cannot remember the path but I am
>sure the linke work as I can more on localtime and get
>something). The problem with that is that the time reported
>by the date command is now one hour off. Strangely enough,
>the time printed by the clock command is exact.
>Example:
>%date
>Mon Dec  2 18:02:09 CST 1996
>%clock
>19:02:09
>I read the man page but that didn't help me.
>Anyone has a solution for this ? I must be overlooking
>something pretty basic here.

For some reason my clock and date commands report different times as
well.  I never use 'clock' for anything and all system events seem to
be synchronized to what 'date' says, so I'm just going to leave mine
alone. :)
  Here is a one line script I've written to set the system date to
that of a remote machine.

date -s "`telnet $1 13 | grep 1996`"

If you'd like to set your clock to that of whitehouse.gov, you use:

script_name whitehouse.gov

This will only work on machines which offer the time service on port
13.  Most flavors of Unix and Windows NT machines do.
  Hope that proves useful,

--------------------------------
I'm a Java programmer/web developer looking for work.
http://www.eecs.wsu.edu/~mhixson
Visit my Linux server to view my resume and download software
I've written.

 
 
 

Linux and correct date/time command

Post by Frank Sweets » Sat, 07 Dec 1996 04:00:00


: >by the date command is now one hour off. Strangely enough,
: >the time printed by the clock command is exact.
: >Example:
: >%date
: >Mon Dec  2 18:02:09 CST 1996
: >%clock
: >19:02:09
I'd guess the confusions has to do with daylight savings time,
probably.

:   Here is a one line script I've written to set the system date to
: that of a remote machine.

: date -s "`telnet $1 13 | grep 1996`"

An easier way to do this is just "netdate <hostname>"

--
----------------------------------------------------------------------

----------------------------------------------------------------------
| There's no problem so big it can't be solved by killing off the    |
| user's account, deleting all their files, and reporting their REAL |
| earnings to the IRS.   -bofh                                       |
----------------------------------------------------------------------
|            If I bothered to sign this, my pgp key's at             |

----------------------------------------------------------------------

 
 
 

Linux and correct date/time command

Post by Jean-Yves Sim » Sun, 08 Dec 1996 04:00:00


: : >by the date command is now one hour off. Strangely enough,
: : >the time printed by the clock command is exact.
: : >Example:
: : >%date
: : >Mon Dec  2 18:02:09 CST 1996
: : >%clock
: : >19:02:09
: I'd guess the confusions has to do with daylight savings time,
: probably.

Hi
is there an environment variable to set for the daylight savings
time?
Actually, someone (Floyd L. Davidson) told me to look at the
w and s parameter of the clock command. I tried that and it
worked, now date and clock report the same time.
Thanks to all the people that posted or e-mailed me.

--

 
 
 

Linux and correct date/time command

Post by Matthew Hixs » Sun, 08 Dec 1996 04:00:00



>:   Here is a one line script I've written to set the system date to
>: that of a remote machine.
>: date -s "`telnet $1 13 | grep 1996`"
>An easier way to do this is just "netdate <hostname>"

Silly me.  I didn't know about that.   However, my script only takes
up 37 bytes of disk space while netdate takes up a whopping 8,992
bytes!  
 :)

--------------------------------
I'm a Java programmer/web developer looking for work.
http://www.eecs.wsu.edu/~mhixson
Visit my Linux server to view my resume and download software
I've written.
 
 
 

Linux and correct date/time command

Post by Ray Lehtinie » Thu, 12 Dec 1996 04:00:00




> >:   Here is a one line script I've written to set the system date to
> >: that of a remote machine.
> >: date -s "`telnet $1 13 | grep 1996`"
> >An easier way to do this is just "netdate <hostname>"
> Silly me.  I didn't know about that.   However, my script only takes
> up 37 bytes of disk space while netdate takes up a whopping 8,992
> bytes!  
>  :)

heheh!  good call....

in response to the original 'losing one hour' question, use /sbin/clock to
fix up the CMOS time.  man 8 clock. (man clock gives you section 3...)

--
---------------------------------------------------------------------------

 
 
 

Linux and correct date/time command

Post by s. keeli » Mon, 16 Dec 1996 04:00:00




   > >: date -s "`telnet $1 13 | grep 1996`"

   > >An easier way to do this is just "netdate <hostname>"

   > Silly me.  I didn't know about that.   However, my script only takes
   > up 37 bytes of disk space while netdate takes up a whopping 8,992

   heheh!  good call....

Hey, you both forgot to include the size of date, telnet, and grep.
--

 If you form the question carefully, giving enough relevant information, in
 context and in an intelligible form, a computer will do its level best to
 give you its best estimate of the answer.  That's better than human!  - me



 
 
 

Linux and correct date/time command

Post by Floyd Davids » Mon, 16 Dec 1996 04:00:00






>   > >: date -s "`telnet $1 13 | grep 1996`"

>   > >An easier way to do this is just "netdate <hostname>"

>   > Silly me.  I didn't know about that.   However, my script only takes
>   > up 37 bytes of disk space while netdate takes up a whopping 8,992

>   heheh!  good call....

>Hey, you both forgot to include the size of date, telnet, and grep.

date, telnet, grep and netdate are already there. Adding a 37 byte
script to do the same thing that netdate does is educational, and
little else.

In any case, the truly elegant thing to do is waste even more
disk space and get xntp up an running.  Then you don't even know,
or care, about when the date gets corrected.  You just know that
if your connection to the Internet is there that your clock is
accurate.

Floyd

--