LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I keep accurate time? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-keep-accurate-time-67481/)

teeno 06-23-2003 10:56 AM

How do I keep accurate time?
 
Hi All,

Does anyone know how I can make sure my Linux box keep accurate time? The problem is that I am using it for barcode labour collection and it keeps gaining about a minute after a month. Is there any way that I can get my Linux box to update its time using the Internet once a week?

Thank in advance.

ranger_nemo 06-23-2003 11:10 AM

You can set it to run ntpdate to go to a timeserver on the net once a day.

Or, use ntp to watch the internal clock on a regular basis.

Check www.ntp.org

jvannucci 06-23-2003 11:15 AM

# su -
# crontab -e

Then in your crontab file add a line:
20 4 * * 0 /usr/sbin/ntpdate time.nist.gov

You might also want to put the same line in your /etc/rc.d/rc.local.

Note that the Red Hat 9 docs (/usr/share/doc/ntp-*) say that ntpdate is now deprecated in favor of ntpd. Perhaps I'm just using it incorrectly, but I've had problems with ntpd for simple updates like you're trying to do. ntpdate works quite well. Also read the docs - you can use multiple time servers, etc.

acid_kewpie 06-23-2003 11:16 AM

ntp is good, if you are actually having a biod clock skew problem, rather than simply wanting to be accurate then you can run ntp as a client daemon on your machine, this will do much more than simply reset the time every so often, as it will calculate average drift of the time and continually make minor adjustments to the time based on results polled from a number of remote ntp servers. so in theory the time is never more than a second or so out, even if you only contact the remote servers every hours or such.

teeno 06-26-2003 07:42 AM

Thank you for all your help.

I have decided to use ntpdate and setup a cron job as suggested.

All your help is much appreciated.

Thank you.

acid_kewpie 06-26-2003 07:56 AM

my suggestion was better ;)

bmike1 10-11-2003 03:40 PM

I agree. Acid_Kewpie's suggestion was better.
 
But how do you get it to do that.

bmike1 10-11-2003 03:49 PM

Quote:

Originally posted by jvannucci
# su -
# crontab -e

Then in your crontab file add a line:
20 4 * * 0 /usr/sbin/ntpdate time.nist.gov



root@bmike1:/home/knoppix# ntpdate time.nist.gov
11 Oct 13:45:03 ntpdate[1091]: no server suitable for synchronization found
root@bmike1:/home/knoppix#

Why did it say that?

mossy 10-11-2003 07:04 PM

Prolly find and download ntp and or ntpd. then install it and read the documentation.

...

Here I found http://www.ntp.org/ this may help configging a server.

Unless acid_kewpie has any other suggestions?


All times are GMT -5. The time now is 08:02 AM.