๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: dc.org.linux-users
Article #272

Re: how do I set the time on my PC?

#272
From: Geof Goodrum
Date: Mon, 01 Oct 2001 22:50
58 lines
3439 bytes
'man hwclock' dated 02 March 1998:

<quote>

It  is important that the System Time not have any discon๏ฟฝ
tinuities such as would happen if you  used  the  date(1L)
program  to  set it while the system is running.  You can,
however, do whatever you want to the Hardware Clock while
the  system is running, and the next time Linux starts up,
it will do so with the adjusted  time from  the  Hardware
Clock.   You  can  also  use the  program  adjtimex(8) to
smoothly adjust the System Time while the system runs.
						 
<unquote>

The docs for ntpdate have a similar note about time adjustment.  You can
confuse time-based system processes if you adjust the time with date.

So what if hwclock has lots of parameters?  You only need a few of them.

If your system stays up for long periods, do:
hwclock --set --date=hh:mm:ss

and repeat a few days later to calibrate your clock.

Add a daily cron or anacron job to run
hwclock --adjust  # apply drift correction to hardware clock
hwclock --hctosys # update system time from clock

If your system is turned on and off on a regular basis:
Add 'hwclock --adjust' to your system startup script
(e.g. /etc/rc.sysinit) before the hwclock line that's already there.

Presto!  You have a self-correcting system clock.  As you note, the
system time is written back to the hardware clock when the system
reboots.

FWIW, my system is network attached, so I prefer to run ntpdate
every hour via anacron.  I don't need the accuracy of the ntp daemon.

Geof

On Sun, 30 Sep 2001 19:26:34 -0400,
<big_daddy.nospam@thediapersuperstore.com> wrote:
>Geof Goodrum <ggoodrumnospam@bigfoot.com> wrote:
>> Using 'date' to set the system time is "Bad Practice" (see 'man hwclock'
>> for why).
>
>> Use 'hwclock' to set the hardware clock for the next reboot if the
>> machine is not network connected (also use the adjtime option), or use
>> ntp or ntpdate (part of ntp package) for network attached systems.
>
>'man hwclock' on my box doesn't tell me that using 'date' is bad.
>
>On my Slackware boxes, the system time is written to the hardware clock on
>all reboots.
>
>hwclock has too many parameters and hoops to jump through :-)
Technical Details
Message-ID: <slrn9rhspm.10e.ggoodrumnospam@cj22743-a.alex1.va.home.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newshub2.home.com!news.home.com!news1.rdc1.md.home.com.POSTED!not-for-mail
References: <3BAE8EA8.B9D37BCA@alumni.umass.edu> <nkp1p9.p5s.ln@hub3.idk-enterprises.com> <slrn9rejm0.mn7.ggoodrumnospam@cj22743-a.alex1.va.home.com> <an98p9.8ns.ln@hub3.idk-enterprises.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 11663c,887e36769819ab0c
X-Google-Attributes: gid11663c,public
X-Google-ArrivalTime: 2001-10-01 15:50:32 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newshub2.home.com!news.home.com!news1.rdc1.md.home.com.POSTED!not-for-mail
From: ggoodrumnospam@bigfoot.com (Geof Goodrum)
Newsgroups: dc.org.linux-users
Subject: Re: how do I set the time on my PC?
References: <3BAE8EA8.B9D37BCA@alumni.umass.edu> <nkp1p9.p5s.ln@hub3.idk-enterprises.com> <slrn9rejm0.mn7.ggoodrumnospam@cj22743-a.alex1.va.home.com> <an98p9.8ns.ln@hub3.idk-enterprises.com>
Organization: http://member.apcug.org/wac/
Message-ID: <slrn9rhspm.10e.ggoodrumnospam@cj22743-a.alex1.va.home.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: slrn/0.9.6.4 (Linux)
Lines: 58
Date: Mon, 01 Oct 2001 22:50:31 GMT
NNTP-Posting-Host: 24.15.177.146
X-Complaints-To: abuse@home.net
X-Trace: news1.rdc1.md.home.com 1001976631 24.15.177.146 (Mon, 01 Oct 2001 15:50:31 PDT)
NNTP-Posting-Date: Mon, 01 Oct 2001 15:50:31 PDT