Changing time zone after installation.

New to Debian (Or Linux in general)? Ask your questions here!

Changing time zone after installation.

Postby cb99 » 2012-09-03 22:04

Hi,

I forgot to change timezone during installation. So I changed it after installation by searching on google. I have dual boot Windows 7 and Debian unstable. I have decided Windows 7 to synchronize time with internet. And debian to use that time. When I noticed I am getting incorrect time, I did following.

Code: Select all
sudo hwclock --systohc --utc

sudo dpkg-reconfigure tzdata

cat /etc/timezone



output is Asia/Kolkata which is correct now.

Then added UTC=yes in /etc/default/rcS


Code: Select all
grep UTC /etc/default/rcS


output is UTC=yes

But when I do
Code: Select all
date


I get

Tue Sep 4 09:01:52 IST 2012

which not correct local time.

I just checked on Windows 7 and it showing me correct time.
cb99
 
Posts: 15
Joined: 2012-09-03 19:12

Re: Changing time zone after installation.

Postby kmathern » 2012-09-04 01:08

In sid & wheezy the UTC variable in the /etc/default/rcS file isn't used anymore, it's now in the /etc/adjtime file.

snippet from `man rcS`
Code: Select all
NOTE
The EDITMOTD, RAMRUN and UTC variables are no longer used.  ....The UTC setting is replaced by the UTC or LOCAL setting in /etc/adjtime, and should have been migrated  automatically.   See  hwclock(5) and hwclock(8) for further details on configuring the system clock....
kmathern
 
Posts: 603
Joined: 2011-02-05 19:20

Re: Changing time zone after installation.

Postby sunrat » 2012-09-04 05:52

Windows expects the hardware clock to be set to local time, Linux expects it to be UTC. There are 2 ways to get the time to show correctly when dual booting with Windows:
- Set the HW clock to local time and tell Linux it is local time using hwclock --localtime command.
- Set the HW clock to UTC and tell Windows it is UTC. This requires editing the registry, see the third reply at https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/does-windows-7-use-utc/e722ad92-a65b-4c0a-8c05-b8a84fb155d1
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2573
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Changing time zone after installation.

Postby cb99 » 2012-09-04 13:32

kmathern wrote:In sid & wheezy the UTC variable in the /etc/default/rcS file isn't used anymore, it's now in the /etc/adjtime file.


This helped to fix it. Thank you.
cb99
 
Posts: 15
Joined: 2012-09-03 19:12

Re: Changing time zone after installation.

Postby cb99 » 2012-09-04 13:34

sunrat wrote:Windows expects the hardware clock to be set to local time, Linux expects it to be UTC. There are 2 ways to get the time to show correctly when dual booting with Windows:
- Set the HW clock to local time and tell Linux it is local time using hwclock --localtime command.
- Set the HW clock to UTC and tell Windows it is UTC. This requires editing the registry, see the third reply at https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/does-windows-7-use-utc/e722ad92-a65b-4c0a-8c05-b8a84fb155d1


Thank you already had added registry entries when I was using Arch Linux. I forgot
Code: Select all
 hwclock --localtime
when I switched to Debian.

Thanks for help.
cb99
 
Posts: 15
Joined: 2012-09-03 19:12

Re: Changing time zone after installation.

Postby jmbvs » 2016-08-17 06:08

About ... dealing with system time set to UTC or not ?

AFAIK most modern OSes expect the system (hardware) clock to be set to UTC. Windows is THE exception... (We all knew that M$ Windows is "exceptional" :-) )

If you are using a Windows system with SP2 or later, I recommend USING UTC as the hardware time, and tell Windows about it. This can be achieved by regedit'ting the key

HKEY_LOCAL_MACHINE\
+--SYSTEM\
+-- CurrentControlSet\
+-- Control\
+-- TimeZoneInformation

and add the value "RealTimeIsUniversal" (DWORD) = 1

Reboot and ... now Windows seems (a bit) better :-)

Have fun

--jmbvs
jmbvs
 
Posts: 1
Joined: 2016-08-17 05:53

Re: Changing time zone after installation.

Postby Head_on_a_Stick » 2016-08-17 07:55

^ So you've necrobumped a *four year old* thread to repeat the solution given by @sunrat this post?

Oh well done...

*slow handclap*

:roll:
User avatar
Head_on_a_Stick
 
Posts: 9206
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Changing time zone after installation.

Postby GarryRicketson » 2016-08-17 13:37

by jmbvs » If you are using a Windows system with SP2 or later, I recommend USING UTC as the hardware time, and tell Windows about it.

Who cares any way ? I am not using Windows , and could care less about this,
I thought this forum is about Debian ,

Debian User Forums

Maybe the recent OP "jmbvs" is a "windows bot" that got lost, and does not know where
it is.
User avatar
GarryRicketson
 
Posts: 5376
Joined: 2015-01-20 22:16
Location: Durango, Mexico


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable