1836995 Members
2064 Online
110111 Solutions
New Discussion

Day light saving

 
FSumair
Occasional Contributor

Day light saving

Hello,

I need to implement DST for the first time but cannot get to know what is tztab and how works.

As far I know. In dst, time is advances 1 hour and after some time it is fall back to 1 hour.

Does tztab changes local system time and increment 1 hour and then decrement 1 hour after date specified in the file.

Could any one help me in this matter.
or give me any example of this.

regards
Farrukh
4 REPLIES 4
TTr
Honored Contributor

Re: Day light saving

man tztab. There is a thourough explanation about each field in the time zone definitions.

> Does tztab changes local system time and increment 1 hour and then decrement 1 hour after date specified in the file.

Well not tztab itself. The kernel changes the time based on the tztab settings. The string that you set in /etc/TIMEZONE is the one that is used to find the tztab section with the same heading.
James R. Ferguson
Acclaimed Contributor

Re: Day light saving

Hi:

The manpages for 'tztab(4)' and 'cron(1M)' offer a good description of how to read the '/usr/lib/tztab' file and how it works.

The real time (in epoch sedconds) never changes. It constantly increments. What changes is the positive or negative offset of your *local* time from universal time (UTC or GMT if you prefer).

You establish a valid 'TZ' value in '/etc/TIMEZONE'. This is read by '/etc/profile' during login to propagate it to your login shell. Users can also set there own TZ values as necessary in their own login profiles. Again, the real time does *not* change; only the offset of local time from it.

Regards!

...JRF...
Matti_Kurkela
Honored Contributor

Re: Day light saving

All Unix systems handle all time values internally in UTC. Any values you input are automatically converted to UTC before storing them and any stored values are converted from UTC to local time just before displaying them. The Unix system clock always uses UTC time internally - regardless of timezone or any possible DST.

The tztab file just contains the rules for changing the conversion offset between UTC and your local timezone. It documents the current _and past_ DST transition rules, so that the system can, for example, automatically calculate the correct number of hours between current time and any past timestamp in any known time zone.

The tztab file is located in /usr/lib/tztab and it contains all the DST rules known to HP at the time of release of that particular HP-UX version. Sometimes some countries change their DST rules, and HP usually issues patches that add the new changes to the tztab file.

Use the "man tztab" command to get more detailed information about the tztab file.

MK
MK
Dennis Handly
Acclaimed Contributor

Re: Day light saving

DST is very simple if you are in one of the established timezones. It is only difficult if you are in a new one or your government decided to change things at the last minute. Or the cases where you need to apply a patch.
As mentioned, tztab(4) and /usr/lib/tztab contain lots of info.