You are not logged in.

#1 2010-05-12 11:13:10

plmday
Member
From: Germany
Registered: 2009-02-19
Posts: 66

[SOLVED] Linux time setting have puzzled me for long ...

Hi, guys,

I have been puzzled by time setting in GNU/Linux for long. On a recent installing on my laptop, I got it wrong again. I can't retain it any more. I want some *clear* explanation. I have read man pages of date, hwclock, rc.conf, wikis in our site, but well, I am just confused. Here is my settings in rc.conf

HARDWARECLOCK="UTC"
TIMEZONE="Asia/Macau"

But the system clock is always wrong. `date` always gives time 8 hour fast. I know what arch does with hardware and system clock when it boots or shutdown. What I can't understand is that why the TIMEZONE info seems totally ignored. In my case, it should be UTC+8, but it seems that when the system boots, it just copies the hardware time to system, without taking the timezone info into account at all. I met this issue in almost every Linux distro I tried. Doesn't the TIMEZONE settings means "[+/-]x hours" to UTC? Thanks.

Last edited by plmday (2010-05-13 08:32:52)


Arch, the Portal of Linux

Offline

#2 2010-05-12 11:15:14

thisllub
Member
From: Northern NSW Australia
Registered: 2007-12-28
Posts: 231

Re: [SOLVED] Linux time setting have puzzled me for long ...

install ntp

Offline

#3 2010-05-12 11:15:25

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Linux time setting have puzzled me for long ...

What does 'hwclock' show? Just to make sure, you *are* shutting down properly and you're not dual booting Windows, right?

thisllub wrote:

install ntp

Not a proper solution.

Last edited by falconindy (2010-05-12 11:16:04)

Offline

#4 2010-05-12 11:20:54

plmday
Member
From: Germany
Registered: 2009-02-19
Posts: 66

Re: [SOLVED] Linux time setting have puzzled me for long ...

@falconindy

Yes, I am not dual booting Win. `hwclock` shows time at UTC, the same with `date`

@thisllub

I know ntp could solve the problem itself, but I am wondering why my solution doesn't work

Last edited by plmday (2010-05-12 11:23:26)


Arch, the Portal of Linux

Offline

#5 2010-05-13 01:16:12

theapodan
Member
From: Virginia, USA
Registered: 2008-10-21
Posts: 116

Re: [SOLVED] Linux time setting have puzzled me for long ...

You might try removing

/var/lib/hwclock/adjtime

and rebooting.

Offline

#6 2010-05-13 01:51:42

schen
Member
Registered: 2009-06-06
Posts: 468

Re: [SOLVED] Linux time setting have puzzled me for long ...

Is your system time set correctly? Check it in your BIOS.

Offline

#7 2010-05-13 02:53:39

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Linux time setting have puzzled me for long ...

Your TZ variable may be incorrect:

echo $TZ

Offline

#8 2010-05-13 03:07:40

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: [SOLVED] Linux time setting have puzzled me for long ...

thisllub wrote:

install ntp

NTP is not the solution for these kinds of problems, and it wasn't designed for these kinds of problems. NTP is for syncing by making small adjustments, it's not supposed to handle timezones or big adjustments. Suggesting to use NTP isn't a good idea for these cases nor is it a real solution. The only time you should suggest someone use NTP is if their clock always seems to not stay in time.

As for the timezone issue, when I did have my hwclock set to UTC, I had no problems with the timezone being taken into account (-5 or -4). Removing /var/lib/hwclock/adjtime would be the first thing I would try, otherwise I'd edit rc.local and add the line:

hwclock --utc

Offline

#9 2010-05-13 08:32:27

plmday
Member
From: Germany
Registered: 2009-02-19
Posts: 66

Re: [SOLVED] Linux time setting have puzzled me for long ...

Thanks, guys. I set the system clock using `date` last night before I went to bed. And today when I boot, the time display is right now, smile


Arch, the Portal of Linux

Offline

#10 2010-05-13 11:38:53

leepesjee
Member
Registered: 2008-11-06
Posts: 57

Re: [SOLVED] Linux time setting have puzzled me for long ...

I'm not sure if it will stay that way. Falconindy didn't ask you if you were dual booting windows just out of curiousity.
Windows sets your system clock to local time (did so at least up to XP, not sure about Vista/windows 7). That ruins your settings when using utc. I think you have to use HARDWARECLOCK="localtime" when dual-booting windows.

Edit:
changed 'local' to 'localtime'

Last edited by leepesjee (2010-05-13 12:03:21)

Offline

#11 2010-05-13 13:15:15

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: [SOLVED] Linux time setting have puzzled me for long ...

@leepesjee, he said he wasn't dual booting, but yeah windows xp sets hwclock to local time. I've heard, however, there's a way to change that.

http://weblogs.asp.net/dfindley/archive … 2900_.aspx

Haven't tried it since I rarely go into Windows. Should probably get to it. Would love to set my clock back to utc.

Offline

#12 2010-05-13 13:28:44

leepesjee
Member
Registered: 2008-11-06
Posts: 57

Re: [SOLVED] Linux time setting have puzzled me for long ...

A me bad, did not read carefully. Sorry for the bother.

Offline

Board footer

Powered by FluxBB