Operating System - HP-UX
1758519 Members
2121 Online
108872 Solutions
New Discussion юеВ

Re: Time Change - Automatically at Alternative time

 
Simpson
Occasional Advisor

Time Change - Automatically at Alternative time

All,

I am wondering if it is possible to specify at what time I want DST to roll as opposed to when the system automatically changes. Example. The O/S will automatically adjust it's time ( for DST ) at 2:00am but our applications cannot handle this. I would like the system to automatically change at 5:00am. This is possible in AIX but I can't seem to find away in HPUX without scripting it myself.

Any help or direction would be greatly appreciated.
3 REPLIES 3
Pete Randall
Outstanding Contributor

Re: Time Change - Automatically at Alternative time

Just change the relevant line in /usr/lib/tztab. See man 4 tztab for details.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: Time Change - Automatically at Alternative time

Hi:

I can't understand WHY you would want your server to adjust differently from your geopolitical rules, but that's immaterial.

I can't understand WHY your application "cannot handle this". I would think/hope that your application would log, etc. in epoch seconds (which don't change; only the perception of localtime. That's immaterial too, I guess.

THUS, simply change your '/usr/lib/tztab' using the 'tztab(4)' manpages as your guide. You will want to restart at least the 'cron' daemon and any long-running processes (like your application) or reboot before the appointed change of time in order to read and re-cache your modified rules.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Time Change - Automatically at Alternative time

>I am wondering if it is possible to specify at what time I want DST to roll as opposed to when the system automatically changes.

The system doesn't change the time, only libc changes the presentation.

>will automatically adjust its time (for DST) at 2:00am but our applications cannot handle this. I would like the system to automatically change at 5:00am.

As mentioned by Pete and JRF, you can change tztab.
Or you can also add additional timezones which do what you want and just export TZ for your application to those new ones.

In fact, if you are going to stop your application before 5 am, you can manually do the following:
export TZ=PST8
run application

This basically says that the timezone doesn't change at all. Then you remove that TZ setting when you restart the application.

Note: you can also export TZ to tell libc exactly when DST changes. See environ(5):
export TZ=PST8PDT,M3.2.0/5:00,M11.1.0/5:00

This works for at least 2008:
$ TZ=PST8PDT,M3.2.0/5:00,M11.1.0/5:00 dst.pl
Sun Mar 09 04:59:59 PST 2008 --> Sun Mar 09 06:00:00 PDT 2008
Sun Nov 02 04:59:59 PDT 2008 --> Sun Nov 02 04:00:00 PST 2008
$ dst.pl
Sun Mar 09 01:59:59 PST 2008 --> Sun Mar 09 03:00:00 PDT 2008
Sun Nov 02 01:59:59 PDT 2008 --> Sun Nov 02 01:00:00 PST 2008

>JRF: You will want to restart at least the cron daemon

No need to do this since cron isn't likely to be changing. (Or used by the application?)

>(like your application) before the appointed change of time in order to read

Yes, this would have to be done. And restart after if you don't want to do that next year.