Tech Support > Operating Systems > Linux / Variants > Time Setting...
Time Setting...
Posted by young_child on January 28th, 2004


Hi,

I have the following problems regarding the time settings in my machine.

I have a timezone of +8 from GMT. I have the hardware clock set to the
local time. However, when I boot up linux, the clock shown will be +8
hours from the local time. Everytime when I boot up linux, I need to
reset the clock shown back for 8 hours. How can I do some settings to
get rid of this problem?

Thanks.

Posted by Christopher Browne on January 28th, 2004


After takin a swig o' Arrakan spice grog, young_child <abc@abc.com> belched out:
Two things:

1. Install ntp, and add pool.ntp.org as one of the time sources (and
DON'T put a stratum 1 server in...)

2. Configure your system to set the hardware clock to UTC.

That then allows you to sync ntp against "127.127.1.1", and have
a local time source.

Use UTC; that means you won't have to fiddle around with the hardware
side again in future, and merely have to say, "I'm in the EST zone" or
"I'm in the PST zone" (via setting TZ) in order to see appropriate
timestamps.

One of the Grand Errors of Windows is the convolutions (nay
convulsions) they have to go through by virtue of NOT standardizing on
UTC.
--
let name="cbbrowne" and tld="ntlug.org" in String.concat "@" [name;tld];;
http://www3.sympatico.ca/cbbrowne/ntp.html
(THASSERT (PLANNER RG))
-- Example of HACKER statement.

Posted by Bit Twister on January 28th, 2004


On Wed, 28 Jan 2004 10:56:40 +0800, young_child wrote:
Please read http://www.catb.org/~esr/faqs/smart-questions.html

It always helps if you provide some basic system information and what
you are having problems with when you post questions to the
news groups.

That info helps us to provide better examples/responses.

Which window manager/desktop environment,
they have different icons and file access locations.

There are several "linuxes", about 190+ according to
http://www.distrowatch.com/stats.php

Always provide what distro and release level you are using
when you post questions (Pink Tie 10, Suse 9.0, Mandrake 9.2,...).

Different distros have different commands, files, and links to files,
pacakges and package/software managers.
Even happens between release levels of the same distribution.

Check the following:
cat /etc/sysconfig/clock
UTC=false
ZONE=US/Central
ARC=false

Once you get that correct and you get the system time set correctly,
set the hardware clock with
hwclock --systohc

Posted by Centurion on January 28th, 2004


young_child wrote:

Your setup is configured to believe the hardware clock is set to UTC/GMT.
You need to modify your configuration to expect LOCAL TIME from your
hardware clock.

Some info:
Your computer has 2 clocks; a system clock and a hardware clock. Your
system clock only runs while the operating system is running and it is set
from your hardware clock during the boot sequence. On Debian this is done
with the /etc/init.d/hwclock*.sh scripts.

For Debian, you need to edit /etc/default/rcS and change the "UTC=???"
option to read:
UTC=no

And that's it. Reboot (or run the "hwclock.sh start" script).

If you decide you don't want to reboot, keep in mind some programs might
barf if you suddenly roll the clock back/forward 8 hours! You may want to
drop to single user mode ("init 1") before running the "hwclock.sh start"
script. Once you're done in single user mode, "init 2" will take you back
to the default run level in Debian (Redhat usually use 3 or 5).

Warining!! "init 0"=shutdown and "init 6"=reboot

Knowing which distribution you are running would be helpful too The
instructions here will work for Debian and Debain-based distro's (Knoppix
et al).

James
--
Fortune cookie says:
To whom the mornings are like nights,
What must the midnights be!
-- Emily Dickinson (on hacking?)


Posted by Robert Brendel on January 28th, 2004


have you done a hwclock --systohc (set the hardware clock to the current
system time) after having setup your time?

Robert

Posted by Mark Tsang on January 29th, 2004


Sorry...I may need to specify more about my system...

I am using RedHat 9.0.

I have tried the mentioned method as well. The content in
/etc/sysconfig/clock is correct and I have done hwclock --systohc as well.

However, when I reboot the computer, the clock displayed is again 8
hours faster than the actual time. I need to adjust the clock displayed
at the lower right corner of the screen...

I found that the path /etc/localtime is a link to
/usr/share/zoneinfo/Asia/Hong_Kong as well...

Um...may I ask, the time displayed is referring to the hardware clock
time or the system clock time?

Thanks for all your help again.

Centurion wrote:

Posted by young_child on January 29th, 2004


Sorry...I may need to specify more about my system...

I am using RedHat 9.0.

I have tried the mentioned method as well. The content in
/etc/sysconfig/clock is correct and I have done hwclock --systohc as well.

However, when I reboot the computer, the clock displayed is again 8
hours faster than the actual time. I need to adjust the clock displayed
at the lower right corner of the screen...

I found that the path /etc/localtime is a link to
/usr/share/zoneinfo/Asia/Hong_Kong as well...

Um...may I ask, the time displayed is referring to the hardware clock
time or the system clock time?

Thanks for all your help again.


Centurion wrote:

Posted by young_child on January 29th, 2004


Sorry...I may need to specify more about my system...

I am using RedHat 9.0.

I have tried the mentioned method as well. The content in
/etc/sysconfig/clock is correct and I have done hwclock --systohc as well.

However, when I reboot the computer, the clock displayed is again 8
hours faster than the actual time. I need to adjust the clock displayed
at the lower right corner of the screen...

I found that the path /etc/localtime is a link to
/usr/share/zoneinfo/Asia/Hong_Kong as well...

Um...may I ask, the time displayed is referring to the hardware clock
time or the system clock time?

Thanks for all your help again.

Centurion wrote:

Posted by Ed Murphy on January 31st, 2004


On Wed, 28 Jan 2004 05:09:32 +0000, Christopher Browne wrote:

Christopher is right, and here's why: Daylight Saving Time.

If the hardware clock is set to local time, then you need timed triggers
that go off when DST changes, and adjust the hardware clock to match;
and you must save the DST status in software when you shut down the
computer, in case the shutdown occurs during the "repeated" hour at the
end of the DST period. (Upon restart, the computer must be able to tell
whether it was shut down during the first or second "repetition".) Oh,
and if you change locations, then you must change the triggers and the
saved status. Oh, and some regions use a two-tier DST system (you are
either zero or one or two hours ahead at any given time), so I hope you
didn't implement the saved status as a Boolean flag...

If the hardware clock is set to UTC, then you never have to change it
again (except to correct for drift), and you only have to calculate DST
status when you are actually asked to output local time, and if you
change locations then you only have to change one thing.

http://www.linuxsa.org.au/tips/time.html

http://en.wikipedia.org/wiki/Daylight_saving_time



Similar Posts