SliTaz SliTaz Forum

You are not logged in.

#1 2016-02-08 20:27:03

llev
Member
Registered: 2011-12-09
Posts: 568

ntpd setting hardware clock to local time?

Hi,

I've added this to local.sh to have a correct time at each boot:

[c]ntpd -qp chronos.cru.fr &[/c]

Now the system time is one hour more than it should! Note my timezone is UTC+1.

What is ntpd supposed to do:

- set hardware clock? If so, how can I tell the system that the hardware clock is in local time? (I mean, persistently; invoking [c]hwclock  -t[/c] corrected the problem but the problem reappeared after reboot.)

- set system time? If so, why is it setting time to local+1? Or is it erroneously setting some "kernel UTC time" to local time?

I know little about time management. Thanks for your help.

Offline

#2 2016-02-08 22:46:17

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: ntpd setting hardware clock to local time?

Hardware booting linux only:

Set hardware clock to UTC.

Set TZ file to adjust offset so system displays correct time.

Sync system to timeserver,sync hardware clock to system:

# busybox ntpd -dnqp north-america.pool.ntp.org && hwclock -w -u

Set timezone:

# echo "Europe/Paris" > /etc/TZ

Log out/in

Hardware booting windows and linux:

Windows sets hardware clock and system time to local time.

Set linux TZ to UTC so there is no offset between hardware and system time to display local time.

Offline

#3 2016-02-08 23:22:16

lexeii
Administrator
Registered: 2012-03-21
Posts: 1,853

Re: ntpd setting hardware clock to local time?

Hi there!

My five cents. I have old Windows XP preinstalled on my old netbook. Here is a “patch” to Windows XP to force it to use UTC-based time in the hardware clock. Copy-paste next text, save as file with extension “reg”, for example “WinUTC.reg”, put on your Windows XP Desktop, run it with mouse double-click and confirm.

[c]Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
     "RealTimeIsUniversal"=dword:00000001[/c]
I used Windows XP very rare. This patch works, but anyway sometimes (after wake up from hibernate?) it returns back to its default settings: it guessed that hardware clocks are set to local time sad

Offline

#4 2016-02-09 05:19:35

rerivero
Member
Registered: 2012-06-18
Posts: 235

Re: ntpd setting hardware clock to local time?

with slitaz 4.0 I do this so that (explanation mojo) and synchronizes well harward time and local time

for America/Buenos Aires

# ntpdate -u ar.pool.ntp.org && hwclock -w -u

Offline

#5 2016-02-09 05:58:30

Darjeeling
Member
Registered: 2012-02-06
Posts: 210

Re: ntpd setting hardware clock to local time?

Does anyone know how setting the clock actually works on modern hardware? Old motherboards used to have a dedicated CMOS chip containing the clock and a bit of static RAM, buffered by a button cell or a gold-cap. But it seems that on new motherboards clock and persistent memory have moved into one of the large ASICs on the board, northbridge, southbridge, who knows ... and if instead of an externally buffered CMOS RAM they're now using a small Flash memory or, worse still, an EEPROM with a limited number of write cycles, then I wouldn't recommend synchronizing the clock on each boot. But I'm just speculating because I don't know this.

Offline

#6 2016-02-09 09:37:13

devl547
Administrator
Registered: 2011-06-01
Posts: 285

Re: ntpd setting hardware clock to local time?

>I've added this to local.sh to have a correct time at each boot:

>ntpd -qp chronos.cru.fr &

If you use rolling, you can just add to daemons.conf:

NTPD_OPTIONS="-qp chronos.cru.fr"

and also add ntpd to the list of daemons in rcS.conf

Offline

#7 2016-02-09 10:29:05

llev
Member
Registered: 2011-12-09
Posts: 568

Re: ntpd setting hardware clock to local time?

Thanks mojo, and all.

Does [c]hwclock -u[/c] have a persistent effect?

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 1.54 MiB (Peak: 1.77 MiB) ]