cancel
Showing results for 
Search instead for 
Did you mean: 

Dazed and Confused on NTP

 

Dazed and Confused on NTP

We setup our hp-ux 11.23 boxes to use an ntp server. My boss is worried what will happen when DST kicks in this month - will the ntp server change the date on all the clients without any interuption
14 REPLIES
Jannik
Honored Contributor

Re: Dazed and Confused on NTP

NTP always transmits UTC time only. This means daylight saving time is not an issue for NTP.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1341443
jaton
Wouter Jagers
Honored Contributor

Re: Dazed and Confused on NTP

More important is that all your machines are configured in the right DST timezone. Easiest to double check the output of the "date" command on each box, I'd say.

Cheers
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.

Re: Dazed and Confused on NTP

I guess this is what confuses me - once they are all synched and xntpd is running - if I manually change clock ten minutes on one the clients - why does it not sync back up after a little while
TTr
Honored Contributor

Re: Dazed and Confused on NTP

> manually change clock ten minutes on one the clients - why does it not sync back up after a little while

How long does it take to switch back? NTP has certain controls and behaviors about changing the time. In almost all cases you don't want the time to be corrected in one big step while the servir is running in a production environment.

Take a look at tis page for DST and other useful links http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00860404&cc=us&dlc=en&lc=en&jumpid=reg_R1002_USEN
Matti_Kurkela
Honored Contributor

Re: Dazed and Confused on NTP

NTP deals only with UTC time, so the NTP server does not "change the date" on DST transition in any way, shape or form.

UTC time is the basis of timekeeping in all Unix systems. All timestamps are converted to UTC (or rather, UTC-equivalent Unix time_t) for processing, and back to local time for display as necessary.

In a Unix system, only two things change on DST transition:
- the conversion offset for timestamps
- the time zone identifier (changes from Daylight version to Standard version or vice versa, e.g. EDT <-> EST)

The DST logic is also applied whenever past or future dates are displayed. When converting the internal timestamp to human-readable format, the system checks "Is this date supposed to be DST or Standard time?" and converts them accordingly.

Therefore, the Unix DST routine is not something that is used only twice a year: it is used exactly the same way every time a time value is displayed.

Of course, when a programmer explicitly specifies the timezone to be used for output instead of relying on system defaults, he/she can also override the DST logic if necessary, causing summer dates output in Standard time or winter dates in DST - but this is usually not required nor desired.

So each Unix host must have up-to-date DST rules. In HP-UX, these rules are stored in /usr/lib/tztab and chosen with the TZ environment variable.

This thread includes the dst.pl script which can be used to verify that your timezone information is correct and the next conversion will happen when it's supposed to:

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

For the patches required for correct U.S. DST transition with post-2007 rules, see:

http://www.hp.com/go/dst

If you need correct timezone information for non-US systems, go to itrc.hp.com HP-UX patch search and use the keyword "timezone". HP-published timezone information patches are guaranteed to affect /usr/lib/tztab *only*, so getting the Change Control approval to install them if necessary should not be difficult.

MK
MK
TTr
Honored Contributor

Re: Dazed and Confused on NTP

While throwing URLs at you, here is another one.
http://forums.itrc.hp.com/service/forums/helptips.do?#28

Fron the "timothy carroll- Forum profile",
http://forums13.itrc.hp.com/service/forums/publicProfile.do?userId=WW149553&forumId=1
"I have assigned points to 0 of 32 responses to my questions"

Re: Dazed and Confused on NTP

ok - for us knuckleheads - me in particular -
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 ?

Simple question
TTr
Honored Contributor

Re: Dazed and Confused on NTP

If NTP is configured properly it will be slowly adjusted back to the correct time. Check the time now. the difference should be less than 5 minutes already. If not, you need to check the nTP functioning and configuration.
Wouter Jagers
Honored Contributor

Re: Dazed and Confused on NTP

Not automagically, since xntpd does not make such 'big' adjustments.

When you restart xntpd it will probably be corrected, because it will call ntpdate once at startup, unless otherwise configured. And ntpdate does allow itself to make such a big change.

So, in short: only when you restart xntpd.

Cheers
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
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...

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.