Operating System - HP-UX
1753435 Members
4715 Online
108794 Solutions
New Discussion юеВ

Re: Help me read the tztab file

 
SOLVED
Go to solution
Robert DJ
Frequent Advisor

Re: Help me read the tztab file

sorry its 11:00 AM UTC
Robert DJ
Dennis Handly
Acclaimed Contributor

Re: Help me read the tztab file

I don't know about ftpd but using just ftp, it changes the timestamp. You may want to look at another question about preserving timestamps:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1061717
Bill Hassell
Honored Contributor

Re: Help me read the tztab file

ftpd is the server process so when it creates a new file, the timestamp given will be from inetd. Now in a default world, inetd would have been started by the normal startup scripts which in turn source the /etc/TIMEZONE file. But if TZ was somehow modified in a rogue file in /etc/rc.config.d, then a discrepancy would exist. Check that directory in timestamp order with:

ll -t /etc/rc.config.d | head -15

Files at the top of the list are the most recent. There is no such thing as a backup copy or test file in that directory! Everything in that directory will be sourced for in front of every startup script.


Bill Hassell, sysadmin
Robert DJ
Frequent Advisor

Re: Help me read the tztab file

Hi Dennis & Bill,

Thank you for the response!!!

I have tried all the possible settings using the tztab file. I have verified all the setttings related to Timezone on both servers and all seems fine.

Is there a way to modify the tztab for specific location like Albania!!!!

Let me know, if we need to modify any of the values in the tztab file or so...

Before the DST the clock was showing 1 hour behind so we had commented the following

# Middle European Time, Middle European Time Daylight Savings Time
MET-1METDST
0 3 25-31 3 1983-2038 0 METDST-2
#0 2 24-30 9 1983-1995 0 MET-1
0 2 25-31 10 1996-2038 0 MET-1

This resolved the problem, but after the DST changed now its giving us 1 hour ahead.

Any inputs on this will be highly appreciated.

Thank you.

Regards,
Robert
Robert DJ
OldSchool
Honored Contributor

Re: Help me read the tztab file

First off, What problem are you trying to address here? So far, you've wanted a) help reading tztab, b) help because timestamp changes when the file is transferred and c) help getting the timezones set up and properly reporting.

For Item B:
If the problem is that the timestamp on a "transferred file" is changing, that is because is a "new" file on the system it is being transferred to, so the system is marking it w/ a create time equal to the time of transfer. That's just how it works in a normal environment. My first guess is that the cron job that does the transfer doesn't "run constantly" as noted above, but rather is scheduled, perhaps every hour, and that fact results in the timestamp being one hour different than you are expecting. Timestamps simply are *not* preserved when the file is transferred. All of this has been explained previously.

For Item A:
First, read the man pages on tztab, second, change the tztab file back to it's original form. There should be no need for you to edit this file to get the timezones working properly.

NOTE: a quick search on google reveals that the timezone for Albania yields the following info http://www.timeanddate.com/worldclock/city.html?n=284 for Tirane.

Now, about that entry:

1) # Middle European Time, Middle European Time Daylight Savings Time
2) MET-1METDST
3) 0 3 25-31 3 1983-2038 0 METDST-2
4) 0 2 24-30 9 1983-1995 0 MET-1
5) 0 2 25-31 10 1996-2038 0 MET-1

Line #1 is a comment and can be disregarded. Line #2 is the "name" of the timezone, and is in the form of tzname|diff|dstname, where tzname is the tz name or abbreviation, diff is the offset from UTC, and dstname is the name referrenced for DST. In this case tzname is MET, diff is -1, and dstname is METDST. So far, that's all good.

Lines 3-5 define the "rules" for tz adjustments in the Middle Europe. The fields are as follows from left to right, minute, hour, day of month (range in this case) and year range, and day of week (0=Sunday). These fields are used to find the first minute that the time zone adjustment, specified in the seventh column, is to be applied. The tz adjustment name is in the form of either tzname or dstname, followed by the UTC offset value.

Line 3 says that the METDST is UTC-2. It starts at 3:00 on a Sunday that is between the 25th and 31st. This applies to any year from 1983 thru 2038. So, this year, on 3/26 - Sunday, the time went from 01:59:59 MET to 03:00:00 METDST the following second.

Line 4 doesn't apply (based on year)

Line 5 says the the time changes back at: any Sunday that falls between 10/25 and 10/31, at 2:00am, and that this applies to 1996-2038. So, this year, on Sunday, 10/29, the reported time moved from 02:59:59am METDST to 02:00:00am MET one second later.

All of the above jives with the information noted on the website, so the tztab appears to be correct.

For Item C:
From the website, the correct timezone *is* MET-1METDST (or MZT-1MZTDST will work as well)
1) Make sure that the times reported via "date -u" is correct for each server. It should report the correct UTC. If not, the system clock is going to need to be reset to the correct time. All of the times and timezone reporting information is based on the fact that the clock is set to UTC, and UTC doesn't vary.
2) As noted above, examine the contents of /etc/TIMEZONE to insure that the default timezone is set to MET-1METDST
3) As noted above, check the contents of $TZ in root's environment.

If all of the above is correct on the servers in question, you should be reporting the correct time with the "date" command, and that should be UTC-1 at present.

If this doesn't help you resolve your problem, please restate what, exactly, you are trying to correct, along with sample output *again* illustrating the issue.





Bill Hassell
Honored Contributor

Re: Help me read the tztab file

OldSchool has provided an excellent explanation of the txtab file. I will add that this file is actually a repository of timezone changes in lieu of a (very lengthy) TZ value. See the man page:

man environ

While you can put all the details about when the time changes into the TZ value, it is much more convenient to use tztab. Think of tztab as an alias, so when TZ=MET-1METDST, the time library calls search for a match, then use the rule that follows the TZ string. When you commented the line out of tztab, the rule was ignored. What should have happened was to set the system clock to the correct GMT time (use date -u), then pick a correct timezone rule from tztab. But if none exists, just add your own. Call it ALB if you want although it may be more commonly referred to as CET or Central European Time (see the page: http://www.timeanddate.com/worldclock/city.html?n=284 ). To create your entry for Alabania, checki this page for recent and future time cxhanges: http://www.timeanddate.com/worldclock/timezone.html?n=284

Now like every timezone rule, it is driven by political decisions, so you will need to keep tztab up to date. This means you must backup your custom tztab to protect it from future patches. HP can't possibly keep up with every country, state, province, region, city, etc in the world to provide an accurate tztab. The good news is that it is easy to create your own entry.

To test your tztab entry, Clay has created a very useful daylight saving tester. It will produce nothing if the current TZ value does not have change rules, either in the TZ string (see man environ) or in a matching tztab entry. I have attached it here so you can test your custom entry. Note that it can report changes in the past, present or future.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: Help me read the tztab file

>actually a repository of timezone changes in lieu of a (very lengthy) TZ value.

In general, setting TZ to the long string is useless. You can only set it to one year, whereas your application may want to know the time in the past or future years. Using Mm.n.d may work for a range of years, like for tztab but won't work for many ranges or both this year and for the recent Y2K7 changes for next year in the USA.

As Bill says, watch out for those patches.
Robert DJ
Frequent Advisor

Re: Help me read the tztab file

Hi OldSchool, Dennis & Bill,

Thank you for your information!!!!

I think am addressing a peculiar issue with TIMESTAMP.

Cause i do have other servers as on which i have not faced any issues like this till date.

I can perfectly understand the tztab functions and so on!!! Thank you all for the help!!!

As with the observation, currently on the timezones, i checked and implemented all possible steps suggested, but was in vain.

As part of the observation, pls find the info below,

1.The UTC time is same on both servers.
2.TIMEZONE is pointing to MET-1METDST.
# more /etc/TIMEZONE
TZ=MET-1METDST
export TZ

3.The cronjobs where restarted after modifying the tztab files.
4.The cronjob runs every 5 mins but not after an hour. The cronjob checks for files in a specific directory and then is ftpd to the other server.

Hope this explains the issue!!!

Or is there any specific patch for the TIMESTAMP, to which i can verify and see.

I thank you all for the patience and for helping me in finding a way out in this issue!!!

Thank you!!!

Regards,
Robert.
Robert DJ
Dennis Handly
Acclaimed Contributor

Re: Help me read the tztab file

>2.TIMEZONE is pointing to MET-1METDST.

I would suggest also printing $TZ.

>3.The cronjobs where restarted after modifying the tztab files.
>4.The cronjob runs every 5 mins but not after an hour. The cronjob checks for files in a specific directory and then is ftpd to the other server.

So they can be off by 5 minutes.

Just to make sure tztab has nothing to do with it, when you go to check the timestamps on the files, use:
TZ=UTC0 ll file ...
OldSchool
Honored Contributor

Re: Help me read the tztab file

OK, if the issue is TIMESTAMPS, and the servers are all reporting the correct time when using "date -u", I think my next step would be to verify that the "problem" occurs on every file transfer.

Assuming serverA is source, and serverB is both the destination and is the server demonstrating the problem then I would:

1) create a new file on serverA. It can be anything, you just need to know that it was created at a given time. Verify w/ command noted by Dennis above, ie.
TZ=UTC0 ll

2) ftp to serverB and transfer the file created above.

3) Immediately after that, log on to serverB and verify the timestamp again w/ TZ=UTC0 ll

If this reports the correct time, then the issue is that the file is not getting "picked up" by the cron job on serverA when you think it is.

If this DOES NOT report the correct time, I think my next step would be to restart inetd on serverB (the one where the problem shows up) using the following command.

/sbin/init.d/inet stop; /sbin/init.d/start

NOTE:
a) Type the above command all on one line
b) Be absolutely sure that YOUR TZ variable is set correctly and exported before entering the command

Re-run the test and see if the results change