[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: date gives tomorrows date




On Sat, 13 Oct 2001, Tony wrote:

>
> Potato 2.2.19 Linux only box. I'm having a problem with the dates.
> $date Sun Oct 14 03:58:09 EST 2001 <- is tomorrow $date -u Sat Oct 13
> 17:59:40 UTC 2001 <- is correct have checked the date in the BIOS is
> ok. have tried UTS=yes and UTS=no in the /etc/default/rcS and it is
> still the same. Anyone know how get the right date?

I think the issue is that the hardware clock and the system are not in
sync.

A crude but effective way of making all these problems go away is by
running ntpdate in your dialup script (I'm assuming dialup) and then
synchronising to the hardware clock.

Install ntpdate (apt-get install ntpdate), and put a script called ntpdate
in /etc/ppp/ip-up.d as follows (put a local ntp server in place of
clock1.unc.edu). See http://www.eecis.udel.edu/~mills/ntp/servers.htm for
a list of public ntp servers and use one that is close to you on the net.

if you don't have dialup but have an always-on connection like with dsl or
cable modem, then you are better off using the ntp package, which runs a
daemon and periodically contacts an ntp server.

                               Sincerely, Faheem Mitha.

#!/bin/sh

#invoke ntpdate to set time from system clock
if [ -x /usr/sbin/ntpdate ]; then
        /usr/sbin/ntpdate -s -t 5 clock1.unc.edu
        /sbin/hwclock --systohc
fi



Reply to: