Operating System - HP-UX
1752761 Members
5263 Online
108789 Solutions
New Discussion юеВ

Re: Dazed and Confused on NTP

 
James R. Ferguson
Acclaimed Contributor

Re: Dazed and Confused on NTP

Hi:

> i change my system date from Tue Oct 13 15:50:43 EDT 2009 to Tue Oct 13 15:55:43 EDT 2009 A 5 minute change - will it get synched back up ?

Eventually. This will take some time and will either occur gradually (if you specified a "slew" change) or will jump the clock in a large step. If the time delta is greater than about 1000 seconds, NO synchronization will occur as NTP will conclude that some "insane" condition exists.

You are safest (when dealing with databases and time-sensitive processes) to correct time differences ONCE during bootup and then let NTP maintain the time. You are generally safe stepping a server's time _forward_. Stepping a server's time backwards can have serious consequences for logging and particularly for database recoveries!

See also, my comments in your companion thread, here:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1378416

Regards!

...JRF...
timothy carroll
Advisor

Re: Dazed and Confused on NTP

Thanks for clarifying - not just to be sure - when DST kicks in at end of month - will I have to manually do anything, or will ntp etc synchronize my time..

Thanks for having patience - I am a dba
Patrick Wallek
Honored Contributor

Re: Dazed and Confused on NTP

>> will I have to manually do anything

NO, you will not have to do anything.

>>, or will ntp etc synchronize my time..

No, NTP will NOT sync the time.

I think there is still some misunderstanding of how time works in HP-UX (an unix in general).

HP-UX keeps ALL time in UTC/GMT. So, when DST rules take effect there really is not any time change. What changes is the way time is DISPLAYED to you when you use the 'date' command.

There was a pretty good explanation of HP-UX time above, I believe, so I won't go into detail.

If your /etc/tztab is up to date with all appropriate time zone rules, then you will not have to do anything, nor will NTP.
Bill Hassell
Honored Contributor

Re: Dazed and Confused on NTP

As stated before, HP-UX time *NEVER* jumps forward or backward. That's because Daylight Saving time (as well as timezones themselves) are political concepts and has little to do with the rotation of the earth. To accommodate these idiosyncrasies, HP-UX has a translation table, /usr/lib/tztab which provides dozens and dozens of timezones. The man page for "environ" details how to create a customized TZ value just for your login. This allows HP-UX to display the correct time for any user connecting from anywhere on earth.

So when a DST change occurs, *NOTHING* happens to the clock. The UTC time (also known as GMT or Zulu time) ticks normally and NTP maintains sync. But the representation (and interpretation) of time is translated by the $TZ value which follows the rules in /usr/lib/tztab. If you run the date command in a loop during your local DST change (ie, 2am to 3am), you will see the time seems to jump by an hour but the date -u value ticks normally. So NTP does exactly the right thing -- keep the system clock synced to UTC. Your only sysadmin task is to keep the tztab file updated with the timezone changes that you want to track (typically your local timezone).

Now if you force the time off by 10 minutes, it will take *HOURS* to slowly move the time back to normal. The reason is that xntpd must never skip or add a single second to a 24 hour day -- exactly 86400 seconds. xntpd uses the library call adjtime to change the time between ticks, typically microseconds. So after a big time change like 5 minutes forward, xntpd will reduce a one second tick to slightly more than one second and let the clock slow down to match the NTP server time.

NTP is a very sophisticated protocol, capable of maintaining system time to within 128 milliseconds despite variable communication delays and outages. To read more about the protocol, check out:

http://www.ntp.org/ntpfaq/NTP-a-faq.htm
or
http://www.ntp.isc.org/bin/view/Main/WebHome


Bill Hassell, sysadmin
mvpel
Trusted Contributor

Re: Dazed and Confused on NTP

Fun with Time Zones:

My normal time, here in the Boston area:
$ TZ=EST5EDT
$ date
Wed Oct 14 06:46:20 EDT 2009
$ # Setting to Russian Pacific time:
$ TZ=WST-11WSTDST
$ date
Wed Oct 14 22:46:35 WSTDST 2009
$ # Setting to a bogus time zone
$ TZ=FOO-14BAR
$ date
Thu Oct 15 01:46:57 BAR 2009
$ # File timestamps
$ cd /tmp
$ touch foo
$ ls -ls foo
-rw-r--r-- 1 pelletm tty 0 Oct 15 01:47 foo
$ TZ=EST5EDT
$ ls -sl foo
-rw-r--r-- 1 pelletm tty 0 Oct 14 06:47 foo
$

Remember, the time zone is only a display filter. The system time is always in UTC.