Operating System - HP-UX
1834459 Members
2955 Online
110067 Solutions
New Discussion

Re: Need to prevent time change

 
SOLVED
Go to solution
Sergey Yazikov
Occasional Contributor

Need to prevent time change

I'm wondering how to prevent the time change at the next fall-back hour. I run some processes that use the UTC time and any time change is undesirable on my HP-UX 10.20 at all. I read the man page for the tztab and it says: ???If the value of the TZ string does not match any line in the table, it is interpreted according to the current U.S. pattern.??? So should I manually modify the tztab for GMT0BST and comment the line ???0 1 25-31 10 1996-2038 0 GMT0???. I have GMT0 in my /etc/TIMEZONE file. Anybody tried that?
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: Need to prevent time change

Hi:

The server's time does *not* change, only the external, displayed representation as specified by the TZ variable. Therefore, there should be no need to modify anything. Leave your TZ variable set to reflect the local time conventions as appropriate for your locale.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Need to prevent time change

I'm not sure why you would want to change this. Remember, all the UNIX boxes in the known universe actually have the same time. i.e. The number of seconds since Jan 1, 1970.
Setting TZ only affects how the time is displayed. What you might want to do is create a new TZ setting - maybe 'UTC0UTC' and also have a matching entry in tztab. This would be preferable to altering an existing entry. This would only be necessary if you have some reports that for some reason you do not want the time change to be reflected in. If that is the case, your reports should have really been using the gmtime() function rather than localtime().
If it ain't broke, I can fix that.
Thierry Poels_1
Honored Contributor

Re: Need to prevent time change

yep,
the internal clock doesn't change at summer/winter time, and should be equal to Greenwich Mean Time (GMT), on unix also known as UTC time, Universal Time C....:) (hmmmmz) and can be checked with "date -u".
The date/time you see with the date command, is a calculation based on your TZ (timezone), daylight savings time yes/no and the internal clock.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Sergey Yazikov
Occasional Contributor

Re: Need to prevent time change

Ok, I understand the internal time does not change but what about the user processes? They do get their time changed. Unfortunately I'm unable to modify the code to replace localtime() call with gmtime(). Simply the users time should always be equal to the UTC time. So solution is probably create some bogus time zone, insert it in the tztab and to kill/rerun the processes so they pick up the new TZ variable.
Bill Hassell
Honored Contributor
Solution

Re: Need to prevent time change

Don't use a bogus timezone, just set TZ=GMT0 (that's G M T zero) for everyone on the system that logs in. There will be no time change for any user. Of course, your users may have to be educated about different timezones.


Bill Hassell, sysadmin
Sridhar Bhaskarla
Honored Contributor

Re: Need to prevent time change

You read correctly... "it is interpreted". You can set the TZ variable to whatever the valid TIMEZONE.As long as the time is converted correctly to GMT, there is no problem.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sergey Yazikov
Occasional Contributor

Re: Need to prevent time change

Yep, I put the time to 10/27/01 23:58 and it did not change, the TZ was set to GMT0. Anyway it's better to be a paranoid sometimes. Thanks to who replied.