Operating System - HP-UX
1838523 Members
3143 Online
110126 Solutions
New Discussion

tztab, can't make it work with DST

 
SOLVED
Go to solution
Ivan Ferreira
Honored Contributor

tztab, can't make it work with DST

Hi all.

As patches for my country DST time changes are not released, I need to configure a tztab rule to handle DST changes.

I'm trying to configure a test system but I can't make it work.

I just want to set a DST rule for 2008 only that:

At Sat, March 8 23:00, the Standart Time (ST) is in place.
At Sun, October 19 01:00 the Summer Time (DS) is in place.

I have configured the tztab file as follows:

PYST4PYDT
0 23 8 3 2008 6 PYST4
0 1 19 10 2008 0 PYDT3

Then I test it with:

# export TZ=PYST4PYDT
# date
Tue Aug 19 17:00:05 PYDT 2008


As you can see, it assumes that the DT time is in effect, when in fact, the ST should be in effect.

Also:

# /root/dst.pl
Sun Apr 06 01:59:59 PYST 2008 --> Sun Apr 06 03:00:00 PYDT 2008
Sun Oct 26 01:59:59 PYDT 2008 --> Sun Oct 26 01:00:00 PYST 2008


Ignores my rules.

I have tried a lot and searched for a solution in this forum and I can't find it.

I also tried with the exact example in the man of tztab, same results. DS time is in place when ST should be.

Any help would be appreciated.

Thanks in advance.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
10 REPLIES 10
TTr
Honored Contributor
Solution

Re: tztab, can't make it work with DST

From the man page

Either the day of the month or the day of the week field must be a range, the other must be simple number.

So one of the 3rd and 6th column must be of type range and the other must be a simple number. This makes resolving the day of the month possible. I know it is resolvable with simple numbers for single year entries but these are meant for year ranges and the syntax must be followed.
Dennis Handly
Acclaimed Contributor

Re: tztab, can't make it work with DST

>As patches for my country DST time changes are not released,

Have you contacted your local HP Support organization? Do you have some official government document describing this in detail?
See:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1182214
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1210672
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1181515
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1234321
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1224306

># /root/dst.pl

It's good you have Clay's script.

>Ignores my rules.
>I have tried a lot and searched for a solution in this forum and I can't find it.

You should have found a bunch of my replies. :-)
In particular:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1225597
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1234321

>TTr: From the man page

Unfortunately it doesn't say that ranges must be EXACTLY 7 days. :-(
TTr
Honored Contributor

Re: tztab, can't make it work with DST

I don't know if you have any patching issues but I tested your entries and got the same results. Then I changed the day of the week to 0-6 and worked like a charm.

Since you are on the southern hemisphere you should change the PYST4 to 2009 if that was your original intend.
Ivan Ferreira
Honored Contributor

Re: tztab, can't make it work with DST

Changing to:

# PYT4PYST
0 23 8 3 2008 0-6 PYT4
0 1 19 10 2008 0-6 PYST3


Seems that did the job. Thanks to all.

But it seems that the information is "cached", as if for example, I change from 19 oct to 20 oct (as day of the week is 0-6 it should work), information is not updated in the output of dst.pl.

Still investigating that.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
TTr
Honored Contributor

Re: tztab, can't make it work with DST

It updated for me. Did you ensure that the change in /usr/lib/tztab was saved?

myserver:/># export TZ=PYST4PYDT
myserver:/># ./dst.pl
Sat Oct 18 23:59:59 PYST 2008 --> Sun Oct 19 01:00:00 PYDT 2008

Edit /usr/lib/tztab and change 19 to 20.

myserver:/># ./dst.pl
Sun Oct 19 23:59:59 PYST 2008 --> Mon Oct 20 01:00:00 PYDT 2008

Ivan Ferreira
Honored Contributor

Re: tztab, can't make it work with DST

PYT4PYST
0 23 8 3 2008 0-6 PYT4
0 1 19 10 2008 0-6 PYST3
0 23 14 3 2009 0-6 PYT4
0 1 18 10 2009 0-6 PYST3


# export TZ=PYT4PYST
# dst.pl
Sat Oct 18 23:59:59 PYT 2008 --> Sun Oct 19 01:00:00 PYST 2008

Edit tztab

PYT4PYST
0 23 8 3 2008 0-6 PYT4
0 1 20 10 2008 0-6 PYST3
0 23 14 3 2009 0-6 PYT4
0 1 18 10 2009 0-6 PYST3

Change 19 to 20 for year 2008

# dst.pl
Sat Oct 18 23:59:59 PYT 2008 --> Sun Oct 19 01:00:00 PYST 2008
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
TTr
Honored Contributor

Re: tztab, can't make it work with DST

It updated for me. I followed exactly your steps with the 4 entries in tztab. What OS do you have? I tested on 11.11 patched to Dec 2006.

Try starting a new shell after editing and saving tztab and export the TZ variable all over again. (I didn't have to)

PYT4PYST
0 23 8 3 2008 0-6 PYT4
0 1 19 10 2008 0-6 PYST3
0 23 14 3 2009 0-6 PYT4
0 1 18 10 2009 0-6 PYST3

myserver:/># export TZ=PYT4PYST
myserver:/># ./dst.pl
Sat Oct 18 23:59:59 PYT 2008 --> Sun Oct 19 01:00:00 PYST 2008

Edit tztab and save it.

PYT4PYST
0 23 8 3 2008 0-6 PYT4
0 1 20 10 2008 0-6 PYST3
0 23 14 3 2009 0-6 PYT4
0 1 18 10 2009 0-6 PYST3

myserver:/># ./dst.pl
Sun Oct 19 23:59:59 PYT 2008 --> Mon Oct 20 01:00:00 PYST 2008

Ivan Ferreira
Honored Contributor

Re: tztab, can't make it work with DST

Maybe a problem with the O.S. version or patch missing, thanks for taking the time to test it.

This is a system that is there just for "playing" purposes, so don't expect to be updated.

HP-UX hpux B.11.23 U ia64 1598329103 unlimited-user license

swlist |grep -E -i "gold|qpk"
QPKAPPS B.11.23.0512.034 Applications Quality Pack Bundle for HP-UX 11i v2, December 2005
QPKBASE B.11.23.0512.034 Base Quality Pack Bundle for HP-UX 11i v2, December 2005
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Dennis Handly
Acclaimed Contributor

Re: tztab, can't make it work with DST

>Ivan: But it seems that the information is "cached"

Yes, tztab(4) is mmapped. The last time I was debugging the Brazil thread, I thought it wasn't taking my changes. But when I restarted the program it worked. Looking at the code, it checks the modification time before looking at the mmapped file.
Which implies you don't have to restart any process if you change tztab(4). (I suppose this could be a 11.31 fix?)

Ivan Ferreira
Honored Contributor

Re: tztab, can't make it work with DST

Thanks!
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?