* [gentoo-server] UTC vs. localtime
@ 2005-08-09 16:58 Robert Larson
2005-08-09 17:03 ` Jason Harley
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Robert Larson @ 2005-08-09 16:58 UTC (permalink / raw
To: gentoo-server
Hello list,
I just recently switched a few of my servers of to UTC from localtime due to
an new application deployment relying on UTC time. I am now having problems
with this as the real time is not reflected. I also made these changes to
gentoo running in usermode linux on one of the machines, and it is now doubly
off.
I have NTP setup and running on all of these machines, and the TZ environment
variable is not set. And, the time would be accurate, if I was on the
equater; I am not.
This is what I changed:
/etc/conf.d/clock: CLOCK="UTC"
/etc/localtime -> /usr/share/zoneinfo/UTC
It was:
/etc/conf.d/clock: CLOCK="local"
/etc/localtime -> /usr/share/zoneinfo/<my timezone>
I have another machine that does reflect the proper time, and it is set as
follows:
/etc/conf.d/clock: CLOCK="UTC"
/etc/localtime -> /usr/share/zoneinfo/<my timezone>
At this point, I am a little confused. These are production systems, and I
wanted to ask before I just go trying things. Is it possible that I just
need to set the clock? If so, does that mean ntpclient and ntpd either
haven't been doing their job, or their syncing to the wrong timezone?
I appreciate the help. :)
Robert
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-09 16:58 [gentoo-server] UTC vs. localtime Robert Larson
@ 2005-08-09 17:03 ` Jason Harley
2005-08-09 18:19 ` Ron Bickers
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Jason Harley @ 2005-08-09 17:03 UTC (permalink / raw
To: gentoo-server
On Tue, 2005-08-09 at 11:58 -0500, Robert Larson wrote:
<snip>
> I have another machine that does reflect the proper time, and it is set as
> follows:
> /etc/conf.d/clock: CLOCK="UTC"
> /etc/localtime -> /usr/share/zoneinfo/<my timezone>
It's my understanding that this is proper -- you're saying your hardware
clock is set to UTC/Zulu/Prime Meridian and that your local time zone is
the proper timezone for the area your server lives in.
This is the way I've always done it, but I admit that I haven't done a
terrible amount of research on the issue.
Cheers,
./JRH
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-09 16:58 [gentoo-server] UTC vs. localtime Robert Larson
2005-08-09 17:03 ` Jason Harley
@ 2005-08-09 18:19 ` Ron Bickers
2005-08-10 2:28 ` Ben Munat
2005-08-10 13:39 ` A. Khattri
2005-08-11 2:51 ` Andrew Cowie
3 siblings, 1 reply; 8+ messages in thread
From: Ron Bickers @ 2005-08-09 18:19 UTC (permalink / raw
To: gentoo-server; +Cc: Robert Larson
On Tue August 9 2005 12:58 pm, Robert Larson wrote:
> I just recently switched a few of my servers of to UTC from localtime due
> to an new application deployment relying on UTC time.
Your new application should be able to work the way you had it before. If it
requires your local timezone to be UTC, it was poorly designed; complain to
the developers.
> This is what I changed:
> /etc/conf.d/clock: CLOCK="UTC"
> /etc/localtime -> /usr/share/zoneinfo/UTC
This says your hardware clock is set to the UTC time, and your local timezone
is also UTC. That's why you're not getting the right local time.
> It was:
> /etc/conf.d/clock: CLOCK="local"
> /etc/localtime -> /usr/share/zoneinfo/<my timezone>
This is the correct way to configure the clock if your hardware clock is set
to the local time.
> I have another machine that does reflect the proper time, and it is set as
> follows:
> /etc/conf.d/clock: CLOCK="UTC"
> /etc/localtime -> /usr/share/zoneinfo/<my timezone>
This is the correct way to configure the clock if your hardware clock is set
to UTC time. The correct adjustment will be made from the hardware clock
when it needs the local time.
> Is it possible that I
> just need to set the clock? If so, does that mean ntpclient and ntpd
> either haven't been doing their job, or their syncing to the wrong
> timezone?
If you set CLOCK="UTC", the hardware clock will get set to the same thing no
matter what your /etc/localtime is. However, you need to correctly set your
timezone so you will get the correct local time.
You should check the man pages on this to be sure, but NTP will not adjust
the clock by more than a certain amount at once, so you may need to set it
manually with 'date' to something close to the current time.
Hope this helps.
--
Ron
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-09 18:19 ` Ron Bickers
@ 2005-08-10 2:28 ` Ben Munat
0 siblings, 0 replies; 8+ messages in thread
From: Ben Munat @ 2005-08-10 2:28 UTC (permalink / raw
To: gentoo-server
Ron Bickers wrote:
>
> You should check the man pages on this to be sure, but NTP will not adjust
> the clock by more than a certain amount at once, so you may need to set it
> manually with 'date' to something close to the current time.
>
I just dealt with this on a new gentoo install last night (it's amazing how much one can
forget between installs!).
The ntp ebuild comes with two rc scripts: ntpd and ntp-client. ntpd you already know
about, but if you run ntp-client ("/etc/init.d/ntp-client start", that is...), it will
fetch the correct time and set it for you (using a command called ntpdate... it's
configured in /etc/conf.d/ntp-client). Then ntpd can keep the time correctly.
b
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-09 16:58 [gentoo-server] UTC vs. localtime Robert Larson
2005-08-09 17:03 ` Jason Harley
2005-08-09 18:19 ` Ron Bickers
@ 2005-08-10 13:39 ` A. Khattri
2005-08-10 14:16 ` Robert Larson
2005-08-11 2:51 ` Andrew Cowie
3 siblings, 1 reply; 8+ messages in thread
From: A. Khattri @ 2005-08-10 13:39 UTC (permalink / raw
To: gentoo-server
On Tue, 9 Aug 2005, Robert Larson wrote:
> At this point, I am a little confused. These are production systems, and I
> wanted to ask before I just go trying things. Is it possible that I just
> need to set the clock? If so, does that mean ntpclient and ntpd either
> haven't been doing their job, or their syncing to the wrong timezone?
Is the BIOS set to UTC?
--
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-10 13:39 ` A. Khattri
@ 2005-08-10 14:16 ` Robert Larson
0 siblings, 0 replies; 8+ messages in thread
From: Robert Larson @ 2005-08-10 14:16 UTC (permalink / raw
To: gentoo-server
On Wednesday 10 August 2005 08:39 am, A. Khattri wrote:
> On Tue, 9 Aug 2005, Robert Larson wrote:
> > At this point, I am a little confused. These are production systems, and
> > I wanted to ask before I just go trying things. Is it possible that I
> > just need to set the clock? If so, does that mean ntpclient and ntpd
> > either haven't been doing their job, or their syncing to the wrong
> > timezone?
>
> Is the BIOS set to UTC?
>
Actually, yes. And, changing the /etc/localtime to my timezone worked, thank
you! :)
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-09 16:58 [gentoo-server] UTC vs. localtime Robert Larson
` (2 preceding siblings ...)
2005-08-10 13:39 ` A. Khattri
@ 2005-08-11 2:51 ` Andrew Cowie
2005-08-11 10:55 ` Benjamin Smee
3 siblings, 1 reply; 8+ messages in thread
From: Andrew Cowie @ 2005-08-11 2:51 UTC (permalink / raw
To: gentoo-server
On Tue, 2005-09-08 at 11:58 -0500, Robert Larson wrote:
> I just recently switched a few of my servers to UTC from localtime
My sense is that the responses you received in this thread, while
helpful, sorta missed the point.
There's no reason for a server to have any system-wide timezone other
than UTC, so yes,
> /etc/conf.d/clock: CLOCK="UTC"
> /etc/localtime -> /usr/share/zoneinfo/UTC
is correct. In fact, setting the hardware clock to UTC is most correct
for any Linux system - the only tie to mess with it is if the Linux
installation on a machine co-exists with a broken OS, say, Windows
perhaps.
But here's the real trick: *any* individual application can localize the
timezone information it gets by [re]setting the TZ environment variable.
And that should be all you have to worry about.
An example of that in action is slashtime, my timezone tool; see
http://www.operationaldynamics.com/time and the underlying code at
http://research.operationaldynamics.com/projects/scripts/#slashtime
It really isn't much more than resetting the TZ variable for various
timezones I'm interested in, and then calling strftime() a bunch.
AfC
Canberra
[P.S. You may have to recorrect the hardware clock *once*, see `hwclock
--help`. Also, be aware that NTP will only act if the skew is within
certain limits, so if you're way out, it won't do anything]
--
Andrew Frederick Cowie
Managing Director
Operational Dynamics Consulting Pty Ltd
http://www.operationaldynamics.com/
Management Consultants specializing in strategy,
organizational architecture, procedures to survive
change, and performance hardening for the people
and systems behind the mission critical enterprise.
Operating Worldwide:
Sydney +61 2 9977 6866
New York +1 646 472 5054
Toronto +1 416 848 6072
London +44 207 1019201
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-server] UTC vs. localtime
2005-08-11 2:51 ` Andrew Cowie
@ 2005-08-11 10:55 ` Benjamin Smee
0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Smee @ 2005-08-11 10:55 UTC (permalink / raw
To: gentoo-server
heya,
On Thu, 2005-08-11 at 12:51 +1000, Andrew Cowie wrote:
> On Tue, 2005-09-08 at 11:58 -0500, Robert Larson wrote:
> > I just recently switched a few of my servers to UTC from localtime
>
> My sense is that the responses you received in this thread, while
> helpful, sorta missed the point.
Agreed! You beat me to the post :)
> There's no reason for a server to have any system-wide timezone other
> than UTC, so yes,
>
> > /etc/conf.d/clock: CLOCK="UTC"
> > /etc/localtime -> /usr/share/zoneinfo/UTC
>
> is correct. In fact, setting the hardware clock to UTC is most correct
> for any Linux system - the only tie to mess with it is if the Linux
> installation on a machine co-exists with a broken OS, say, Windows
> perhaps.
>
> But here's the real trick: *any* individual application can localize the
> timezone information it gets by [re]setting the TZ environment variable.
> And that should be all you have to worry about.
Precisely the point. It is worth noting though that the root user should
never set anything in .bash_profile (or equivalent) to change the TZ
var, that should only be done as a user requiring the different time
view.
On a different note, while someone mentioned the users of ntp-client and
ntpd, it is worth mentioning that openntp doesn't require the same setup
as it IS capable of making large adjustments by itself (ie no annoying
ntpdate -b before starting) and so you can just add the one init script
as supplied. In fact as general I like openntp as a replacement to ntp
BUT AFAIK it doesn't have a ntpq equivalent so its hard to know if its
actually working and how the different peers are functioning.
> [P.S. You may have to recorrect the hardware clock *once*, see `hwclock
> --help`. Also, be aware that NTP will only act if the skew is within
> certain limits, so if you're way out, it won't do anything]
Also worth noting the option:
CLOCK_SYSTOHC="yes"
in /etc/conf.d/clock. This will sync your system time to HW clock on
shutdown and is not a bad idea if you are using a NTPd system.
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-08-11 10:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09 16:58 [gentoo-server] UTC vs. localtime Robert Larson
2005-08-09 17:03 ` Jason Harley
2005-08-09 18:19 ` Ron Bickers
2005-08-10 2:28 ` Ben Munat
2005-08-10 13:39 ` A. Khattri
2005-08-10 14:16 ` Robert Larson
2005-08-11 2:51 ` Andrew Cowie
2005-08-11 10:55 ` Benjamin Smee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox