[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tell Debian to use local time?



On 07/06/2014 06:41 AM Andrew M.A. Cater wrote:
On Sat, Jul 05, 2014 at 04:10:06PM -0500, Nelson Green wrote:
(Added inadvertently omitted subject)

On Sat, Jul 5, 2014 at 3:01 PM, Erwan David <erwan@rail.eu.org> wrote:

Le 05/07/2014 21:38, Nelson Green a écrit :
Good afternoon,

This morning I had the mis-fortune of creating a dual-boot system with
Debian on
a machine that already had windows installed on. I installed a second
hard
drive, installed Debian, and almost everything works. But I apparently
told the
installer that the system clock is set to UTC, when it is not (because
windows
has no real concept of time).

So when I boot to windows the displayed time is the actual local time,
but when
I boot into Debian the displayed time is four hours behind local time.
If I do a
date -u the time that is displayed is the correct local time.

I have modified /etc/adjtime and removed the UTC line, but every time
I boot up
Debian the line re-appears, and the displayed time is still four hours
behind.
So how do I tell the Debian system that the hardware clock is set to
local time
in an effort to compensate for the lessor system's inability to
correctly manage
time?

Thanks,
Nelson

You can tell windows to use UTC internally (while still displaying local
time)
see

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/2000/Q_21805674.html


Thanks Erwan, but I am afraid I have to leave the windows installation
alone.
Fortunately I rarely have to mess with windows, and as a general rule I
don't
lower my standards to theirs, but in this case I have no choice, at least
until
we can eliminate windows from the equation completely.

This problem has been around for a long time: Windows insists on setting the hardware clock to local time. A fix I came up with long ago was to doctor /etc/init.d/ntpd to (re)set the hwclock to UTC on boot. This was on a redhat or opensuse machine, so on a debian machine you'd want to edit /etc/init.d/ntp instead. There wasn't any need to install any additional packages to include this one line in that file.




dpkg-reconfigure -plow tzdata

as root which will allow you to set the global timezone data for your machine.

That way you don't necessarily have to adjust adjtime and can choose which timezone you're in which will
also sort out the DST "stuff".

Reset the clock using the date command to set the time.

date --set=070511352013

Then run

hwclock --systohc

to set the time in the hardware clock which should then be correct for Windows and Linux.

Myself, I keep computers set to UTC all year round.

AndyC


Reply to: