You are not logged in.

#1 2014-05-11 23:34:10

moneytoo
Member
From: Czech Republic
Registered: 2012-04-04
Posts: 20

Setting timezone and hwclock result in bad time saved to bios

When I follow the guide https://wiki.archlinux.org/index.php/be … #Time_zone and set following in chrooted Arch environment, I always end up with bad time saved to my pc bios.

ln -s /usr/share/zoneinfo/Europe/Prague /etc/localtime
hwclock --systohc --localtime

Before the symlink, 'date' prints correct local time - it doesn't know my time zone so it prints the correct time (thinking I'm GMT+0). I use Windows so it's stored in BIOS as local time ('hwclock' also correctly prints local time and not UTC).
After the symlink, 'date' shows incorrect time - it shows my time zone but the actual displayed time is +2 hours from my local time (UTC+1 DST/CEST). It makes sense that 2 hours were added to the time because previously the time was printed as GMT+0.

Single ntp sync in Arch or Windows fixes this time shift forever but it should be possible to prevent this, right?

Offline

#2 2014-05-11 23:39:25

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,917

Re: Setting timezone and hwclock result in bad time saved to bios

Post the output of timedatectl


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-05-11 23:55:47

moneytoo
Member
From: Czech Republic
Registered: 2012-04-04
Posts: 20

Re: Setting timezone and hwclock result in bad time saved to bios

Well, timedatectl doesn't run in chrooted Arch environment...

# timedatectl
Failed to create bus connection: No such file or directory

In booted environment timedatectl is correct, just everything is off 2 hours because of settings made in chroot. (I can post it later. I'm trying to do it right: https://github.com/moneytoo/myarch/blob/master/arch.sh - I know have hwclock commented out to right now)

Offline

#4 2014-05-12 00:03:22

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,917

Re: Setting timezone and hwclock result in bad time saved to bios

Well, the correct answer is to set the RTC to UTC and set your timezone in the manner you indicated.   Only operating systems that were never designed to be connected to the Internet use local time.  NTP will keep the RTC clock synchronized to UTC, but it won't deal with offset when you boot different OSes.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2014-05-12 14:46:54

ackalker
Member
Registered: 2012-11-27
Posts: 201

Re: Setting timezone and hwclock result in bad time saved to bios

While I do agree with @ewaller that UTC is the "way to go", I think "Linux devs" should put a little more effort into supporting both local time and UTC setups
One reason why I think this is important is for people who need to switch between booting a "locked down" Windows (for work, school, etc, where they have no / limited admin rights) and Arch.

If you don't belong to this group of unfortunate people, you can try forcing Windows to use UTC for the hardware clock, no matter which time zone you're in: https://wiki.archlinux.org/index.php/Ti … in_Windows

EDIT:
Try this link for extra steps on newer Windows versions (see JumperPunk's answer, not the accepted one!): http://superuser.com/questions/494432/f … bios-clock

(perhaps this should be condensed and added to the Wiki?)

Last edited by ackalker (2014-05-12 14:57:24)

Offline

#6 2014-05-12 15:37:24

felipe
Member
Registered: 2013-06-29
Posts: 70

Re: Setting timezone and hwclock result in bad time saved to bios

mmm Ubuntu/Debian uses also localtime.

Offline

#7 2014-05-12 15:43:02

moneytoo
Member
From: Czech Republic
Registered: 2012-04-04
Posts: 20

Re: Setting timezone and hwclock result in bad time saved to bios

Yep, setting Windows to UTC works (at least few years back when I tried). But this time I wanted to see if it's possible to work around this issue when installing Arch (without modifying Windows). As felipe noted, other distros has to deal with it as well. I'm curious so I will check installers of other distros if I will have some time.

Offline

Board footer

Powered by FluxBB