You are not logged in.

#1 2012-05-18 15:13:05

Nachiket
Member
From: India
Registered: 2011-08-15
Posts: 14

[SOLVED] Incorrect time displayed in my system

Hey Archers,

I have trouble correct time being displayed in my system.

My BIOS time is:
May 18 2012 08:39:21 PM IST

Date command displays

Sat May 19 02:09:59 IST 2012

Clearly the time displayed by date command is localtime+05:30 (Asia/Kolkata), when I expect it to be just localtime.

How do I correct this?

I dont dual boot and have just Arch installed on my machine.

And my /etc/rc.conf has this:

...
HARDWARECLOCK="UTC"
TIMEZONE="Asia/Kolkata"
...

Please correct if my understanding is wrong, but is this how it works?

When I say HARDWARECLOCK=UTC and TIMEZONE=''Asia/Kolkata",
It assumes, hardwareclock, time displayed by BIOS, is infact UTC, and, since the user is interested in timezone, +0530, it adds 0530 to hardware clock.

Thanks,
Nachiket.

Last edited by Nachiket (2012-05-19 07:22:47)


--Nachiket.

Offline

#2 2012-05-18 15:14:44

Tectu
Member
Registered: 2011-11-10
Posts: 29

Re: [SOLVED] Incorrect time displayed in my system

Hey there,

Take a look at this:   https://wiki.archlinux.org/index.php/Time



~ Tectu

Offline

#3 2012-05-18 16:05:24

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [SOLVED] Incorrect time displayed in my system

I could be wrong -- its been a while since I had a look at the rc.conf file, but I believe that I don't have the HARDWARECLOCK or TIMEZONE listed in rc anymore, I just symlinked my timezone to /etc/localtime.

I'll check tonight ...


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#4 2012-05-18 16:05:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: [SOLVED] Incorrect time displayed in my system

That wiki has the answers.  The problem is your hardware clock is on local time, but you tell arch in rc.conf that it's on UTC, so arch adjusts it accordingly.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2012-05-19 07:18:27

Nachiket
Member
From: India
Registered: 2011-08-15
Posts: 14

Re: [SOLVED] Incorrect time displayed in my system

Hey Tectu,
The wiki article on Time was indeed splendid. It had all the information I needed. Thank you.

Trilby,
You were right, my hardware clock was on local time.

So this is what I did to set it correct.

1. Set the HARDWARECLOCK to "localtime" in /etc/rc.conf

...
HARDWARECLOCK="localtime"
TIMEZONE="Asia/Kolkata"
...

2. Reboot the system

3. Set the systemclock to UTC by doing a -0530 (minus 05 hours 30 minutes)

# date `date -d "-05 hours -30 mins" +%m%d%H%M%Y`

4. Copy the system clock value to hardware clock

# hwclock --systohc

5. Edit the /etc/rc.conf to set HARDWARECLOCK back to UTC

 
...
HARDWARECLOCK="UTC"
TIMEZONE="Asia/Kolkata"
...

6. Reboot the system.

And yes, now my system clock displays correct time smile

Just setting HARDWARECLOCK to "localtime" also worked. But since I the beginners guide recomments "UTC" I did all this.

Marking the thread as SOLVED.

Regards,
Nachiket.

Last edited by Nachiket (2012-05-19 07:23:33)


--Nachiket.

Offline

#6 2012-05-19 15:53:33

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

Re: [SOLVED] Incorrect time displayed in my system

You may want to consider ntp.  You never need to set the clock by hand again smile


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

#7 2012-11-11 21:51:18

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: [SOLVED] Incorrect time displayed in my system

I have been searching for this for long. Thanks for the tip.

Offline

Board footer

Powered by FluxBB