Stop Debian from saving to the hardware clock on shutdown / Prevent Debian from messing up the system time (dualboot with Windows)

I’ve been using Debian for some time now, and faced this problem and could not find a solution myself, neither could I find a clearcut solution on the net.
Well now I’ve found it and would like to share it.

Note-
My hardware clock (also known as BIOS clock) is set to local time. I like it to be set to local time, but if anyone wants to set it to Universal Time, I’ll explain about that also.
Linux distributions like Debian and Arch recommend saving the hardware clock to UTC,
while in Windows and most other operating systems its set to local time.
This creates the problem between time settings of Debian/LMDE and Windows/Other OS’

Procedure-
We will use the hwclock command in the command prompt to configure the clock.

Step1
—————-
First of all check whether the hardware clock is set to local time or UTC using the command-
sudo hwclock -D

This will show you the system time(Operating System time), Hardware clock time and whether hardware clock is set to localtime.
By default in Debian Hardware clock is set to UTC.

Now assuming your system time is correct, write it to the hardware clock and set hardware clock to localtime, use the command-
sudo hwclock -w --localtime

This will set the current system time to hardware clock and configure the hardware clock to localtime.

Step2
——————
If your system time is not correct, first of all make sure your time zone is set correctly by using the command-
sudo dpkg-reconfigure tzdata

Now if the system time is correct, goto step1 and set system time to hardware clock

Otherwise to manually set the system time use the date command-
date -s “1 JUL 2013 20:30:00”

Note-
To set the hardware clock to localtime directly using date command as-
hwclock --set --date='07/23/13 21:10:00' --localtime

Step 3
———————
I don’t like Debian to save the system time to hardware clock at every shutdown,so to prevent Debian from doing that edit the file /etc/default/hwclock as-
sudo nano /etc/default/hwclock
and change HWCLOCKACCESS to NO
(also make sure that the line is uncommented)

Now at shutdown it will say-“Not Saving the System Clock”

Alternate solution-

1.Set other linux distributions to use Hardware clock time as UTC by
sudo hwclock -w --UTC
to set the hardware clock to UTC

Note-
I’ve tried editing /etc/default/rcS and setting UTC=no as posted on many sites but it did not work for me.

2.Configure Windows to use Hardware clock time as UTC

To make MS Windows calculate the time from the hardware clock as UTC. Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation]
“RealTimeIsUniversal”=dword:00000001

———————————————————————————-

Furthur Reading
https://wiki.archlinux.org/index.php/Time

Advertisements