1847343 Members
2931 Online
110264 Solutions
New Discussion

Brazil Timezone

 
SOLVED
Go to solution
John Walker_1
Advisor

Brazil Timezone

Has anyone got HP-UX servers in Brazil? If so can you tell me what entries you have in /usr/lib/tztab, and what your TZ is set to? Brazil do not appear to adhere to any daylight saving time rules. I have this issue twice a year.

Thanks
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: Brazil Timezone

Hi John:

While I don't live in Brazil, it shouldn't be difficult to establish a custom setting by editting '/usr/lib/tztab'. There is nothing special about doing this. Create your entries according the the 'tzlib(4)' manpages. There are quite a few sites that document current times around the world. One is:

http://www.weltzeituhr.com/laender/zeitzonen_e.shtml

Regards!

...JRF...
Don Wilt
Advisor

Re: Brazil Timezone

John,
Brazil does not set a certain weekend of the year for time change, you will need to perform this manually. I don't manage those servers anymore to be able to say what entries are in tztab.
Bill Hassell
Honored Contributor
Solution

Re: Brazil Timezone

Here is a site that documents timezones by country. Brazil is very large so there is no 'Brazil timezone', but 4 separate timezones. Instead, you have to pick your location and verify that it matches your local political definition for time and daylight saving rules:

http://www.timezoneconverter.com/cgi-bin/zonehelp.tzc?cc=BR&ccdesc=Brazil

From this chart, there appears to be 4 timezones with cities such as Sao Paulo observing daylight saving, most others do not. So the answer requires that you determine the rules for your location. If daylight saving is not observed, your task is trivial. The man page for environ covers the TZ variable. Let's suppose that you are located Eirunepe which is 5 hours behind GMT and observes no daylight saving. You would edit the file /etc/TIMEZONE to read TZ=EIR5 then login and the date command will show GMT 5 hours behind GMT.

However, that may not be your local time because when your system was setup, some other TZ value was in effect and that value would be translated to GMT incorrectly. HP-UX keeps time only in GMT and the standard Unix libraries translate GMT into local time based on TZ. So verify that date -u shows the correct GMT time. NOTE: if you have to change the time so that date -u is correct, be sure to reboot so all applications and kernel programs see the new time.

Once date -u is correct, now you can use the proper offset. Note that EIR5 is just a suggestion. As mentioned in the man page for environ, you can use 3 or more characters such as TZ=BRAZILEAST5 and get the same results. You can even use your own name: TZ=JOHN5 (not recommended). All this refers to locations in Brazil that do NOT observe any time change for daylight saving.

Now for tztab, you need to know the rules for change. How is the date determined? Is it the Sunday that falls on the 3rd week of April? Or is it the 21st day of November? You need the two rules (move forward and move back) which you can then translate in your own tztab entry. To help test your entries, I have attached Clay's Perl test script that will show you when daylight saving changes given any year based on a selected entry in tztab.

Or you can take the easy way out: Change TZ to the new offset the evening before the time change. For instance, if you are located in Sao Paulo, the offset is currently 2 hours so TZ might be set to SAO2. When the changeover occurs, you just change the TIMEZONE file to SAO3 and every new login will see the new time. HOWEVER, your applications have their TZ value stored in RAM so you either restart every application (too complicated) or reboot and everything will see the new time.


Bill Hassell, sysadmin
Minoia
Advisor

Re: Brazil Timezone

Hi John,
I'm in late, the Brazilan changed last week.

Our systems host European and Brazilian (Sao Paulo) applications.
The systems run with the standard HP-UX TZTAB and time zone METDST.
For Brazilian we add a new entry in tztab and exported in users profile TZ=BEDT3BEST.
We ran through daylight change without any problem.
Here the entry in TZTAB, it is already configured for the next time switch in Febbruary.

BEDT3BEST

0 1 1-7 11 2006 0 BEST2
0 23 23 2 2007 0-6 BEDT3

Regards
Gianni