Jump to content

Update Your System Clock Using NIST


banjo
 Share

Recommended Posts

I just found out how to update my system clock

using the Cesium clock out at NIST.

 

Find and install rdate-1.3-2mdk.i586.rpm if you do

not already have it. Then, as root, type

 

rdate -s time.nist.gov

 

This will read the clock from the NIST site

and update your clock to match it.

 

To get automatic updates, put it in cron

(assuming that you are online all the time).

 

If you just want to see the time, type

 

rdate time.nist.gov

 

You don't have to be root to see the time.

 

 

Ain't technology grand? 8)

 

Banjo

(_)=='=~

 

(There is probably a fancier way to do this,

but I like to keep it simple)

 

Mandrake 9.1 rocks!

 

Linux rules!

Link to comment
Share on other sites

I thought everyone alread knew about this from Tom's original pages at:

http://www.mandrakeuser.org/docs/utils/utime.html or

http://www.mandrakeusers.org/docs/utils/utime.html

 

It's considered bad practice to use a stratum 1 time server unless you are a stratum 2 time server. See:

http://www.eecis.udel.edu/~mills/ntp/servers.html

 

NIST and US Naval Observatory stratum 1 time servers are listed at:

http://www.boulder.nist.gov/timefreq/servi...me-servers.html and

http://tycho.usno.navy.mil/ntp.html

Most restrict access to stratum 1 servers. If you try to use them, you'll get "CONNECTION REFUSED." The time.nist.gov server allows free access but you can get several seconds of inaccuracy because it is so heavily used.

 

There's a list of stratum 2 NTP servers at:

http://www.eecis.udel.edu/~mills/ntp/clock2a.html

For the greatest accuracy, especially using rdate, pick the closest server.

 

Getting the time from a local stratum 3 server will probably set your clock more accurately then pinging a stratum 1 or 2 server that is more distant. The delays and errors as your ping and the reply transit the Internet are far greater than the tiny difference in accuracy between stratum 1 and 3 when using rdate, which does little to compensate for latency delays. Try ntp1.yourisp.domain or ntp-1.yourisp.domain. I use ntp1. or ntp2.crosslink.net, my ISP's local network time servers, when I can't get time more accurately via CHU or WWV.

 

NTP clients/servers are the 'gold standard' and xntp is included in every major Linux distribution. Unfortunately, NTP software is bloated and an NTP server uses a lot of resources. Although NTP can run without continuous Internet access, it's a pain to do so and becomes an "error averaging" system that might remain accurate but is at the mercy of the drift of the individual computers in the network. With continuous Internet access, NTP servers will ping higher stratum servers for time corrections every 11 or so seconds to stay synchronized.

 

SNTP (Simple Network Time Protocol) clients replaced rdate. SNTP applies some corrections to compensate for network latency and is far more accurate than rdate. I don't know why distro's don't include an SNTP client. Perhaps I'll build an SNTP rpm for contrib's over the winter since I'm in the process of learning about building rpms.

 

You can get the source code for a Perl implementation of SNTP at:

http://www.kloth.net/software/sntp.php

I haven't used it. Dr Berstein's ClockSpeed and TaiClock at:

http://cr.yp.to/time.html

are written in C and are what I'm working with in my home network. Try out clockspeed. It's supposed to 'discipline' the system clock to compensate for drift. I hope that TAI will be compiled into kernels in the near future as we approach 2036 when Unix time will crash. Check Dr Berstein's pages for his take on the problems. I like TAI and TaiClock but I break my systems too often when trying to custom compile kernels. {grumble}

 

Although it's no longer maintained, there's a good mini-HOWTO at:

http://www.icewalkers.com/Linux/Howto/mini/Clock.html

Most of the information is still current. I've actually used Canada's CHU time broadcasts to get stratum 1 accuracy in my home network. The shortwave radio received cost 5 USD at a garage sale and has worked for years. See:

http://www.rossi.com/chu/

It's possible to get stratum 1 accuracy at home. Chrony is also good, especially the scripts for turning your time client on and off by modifying ppp scripts so your time client isn't constantly trying to ping an NTP server when you have no Internet connection.

 

The xntp HOWTO at:

http://www.icewalkers.com/Linux/Howto/Time...OWTO/index.html

is still maintained.

 

Sorry, but using rdate isn't very accurate. It does a poor job of compensating for latency in the Internet. It's just a novelty to say that you synchronized with the atomic clock at NIST. Expect accuracy of only +/- a few seconds using rdate and the NIST public server. More accurate is a phone call to NISTs public phone server to get accuracy of +/- .5 second or better. SNTP and Clockspeed can give you accuracies of about +/- 50 milliseconds. NTP with a continuous connection to the Internet can maintain accuracy of +/- 5 mS. To get more accuracy costs money for GPS or WWV receivers and precision crystals in phase-lock loops and...

 

Learning about time in Linux can be interesting. I guess I'm a 'time geek' ??

Link to comment
Share on other sites

Great links. I guess I will go find a new

time server to use with my rdate command.

 

My goal is really just to keep my crappy PC clock

synched up enough to be on time for dinner, so the

more complex updating schemes are a bit of an

overkill for me. Besides, my wristwatch synchs up

with WWVB every night at 1 a.m, so I can always

manually set my clock using my wristwatch for better

accuracy. I just think that it is really cool that I can

update my system clock (more or less) with a simple

command.

 

Ain't technology grand?

 

Linux rocks!

 

Banjo

(_)=='=~

Link to comment
Share on other sites

:shock: :lol:

 

Guess who didnt had much trouble finding his stratum2 time servers?

 

The first 3 are for Argentina! wujuuu!

 

Also putted up in my site a guide i found about Network Time Protocol in Spanish.

check it out:

http://somosinvisibles.com.ar/staticpages/...030926013304598

Link to comment
Share on other sites

it is really cool that I can update my system clock (more or less) with a simple command.

Ain't technology grand? Linux rocks!

And what would you say if you didn't even have to type this command :shock: ?

If you're on dial-up, just put the command to connect to your level2 or level3 time server, inside the /etc/ppp/ip-up.local file, and it will automatically be done at each connection 8)

 

Yves.

Link to comment
Share on other sites

I learn the coolest things on this board.

 

Thanks for the tip about /etc/ppp/ip-up.local.

Does it run as root? My computer will not update

the clock unless I am root. I will give it a try

when I am at home (I am forced to use fnWindoze

here at work :evil: )

 

I did have another question about the time servers

though. I went through the list of stratum 2 NTP servers

at the NIST web sites, but every one that I tried to

connect to refused my connection. I am so confused.

I thought that they are supposed to be more

accessible than the stratum 1 servers ???

 

So, I have temporarily gone back to time.nist.gov,

which appears to accept my query with no problems.

 

Banjo

(_)=='=~

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...