Re: Help me read the tztab file (526 Views)
Reply
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 1 of 21 (526 Views)
Accepted Solution

Help me read the tztab file

Hi All,

We would require you to kindly let me know how i can read the tztab file.

Further to this, i have set Timezone for Europe, which is mentioned below,

# 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

When a file is transfered from one system to another system, the timestamp changes by 1 hour.

e.g: test.txt was created by 4:00 AM and is transfered to the another system for verification, the time changes to one hour ahead, like test.txt with time as 5:00 AM.

Please do help me in sorting out this Issue.

Any help would be really appreciated.

Thank you.

Regards,
RDJ
Robert DJ
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 2 of 21 (526 Views)

Re: Help me read the tztab file

Hi Again,

I am able to read the tztab file, but want explanation on why the time difference is happening with nearly 1 hour.

Any help would be greatly appreciated.

Thank you.

Regards,
RDJ
Robert DJ
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,855
Registered: ‎03-06-2006
Message 3 of 21 (526 Views)

Re: Help me read the tztab file

>Help me read the tztab file

This is described in tztab(4) and TZ with environ(5).

>When a file is transfered from one system to another system, the timestamp changes by 1 hour.

(What are you doing to prevent the timestamp from changing to the current time when you do this?)

That suggests one of the machines has the wrong time or TZ isn't set correctly.

What does "date -u" show on each machine?
(Right now it should show: Tue Nov 14 07:10:45 UTC 2006)

What does the following show for the file on each machine:
TZ=GMT0 ll file-name

If both of these commands show the same time, then the problem is with different TZ settings or tztab.
Please use plain text.
Honored Contributor
Kent Ostby
Posts: 1,836
Registered: ‎09-26-2000
Message 4 of 21 (526 Views)

Re: Help me read the tztab file

Robert -- More than likely the TZ are set differently on the two machines.

On each machine do the following:

env | grep TZ

what do they show?
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 5 of 21 (526 Views)

Re: Help me read the tztab file

Hi Kent & Denis,

Thank you for response!!!

Here are the few things which was been asked and please find them as below. I have verified in both the Servers.

Server 1:
serv1a$ date -u
Tue Nov 14 11:06:54 UTC 2006
serv1a$ date
Tue Nov 14 12:07:20 MET 2006
serv1a$ echo $TZ
MET-1METDST

Server 2:
serv2a$ date -u
Tue Nov 14 11:09:25 UTC 2006
serv2a$ date
Tue Nov 14 12:09:39 MET 2006
serv2a$ echo $TZ
MET-1METDST

Please do the needful.

Thank you.

Regards,
RDJ
Robert DJ
Please use plain text.
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 6 of 21 (526 Views)

Re: Help me read the tztab file

I doubt that this is the issue, but could you please check the contents of the file "/etc/TIMEZONE" on both machines?.
Please use plain text.
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 7 of 21 (526 Views)

Re: Help me read the tztab file

I just re-read the original post, and you are "transferring" the file.

Is the file being transferred w/ a cronjob? Does that job run about 1 hour after the file would have been created?

rcp and ftp are going to time-stamp the destination file w/ the time that the transfer occurred. Is this the difference you are seeing?
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,855
Registered: ‎03-06-2006
Message 8 of 21 (526 Views)

Re: Help me read the tztab file

>Robert DJ Nov 14, 2006 12:11:41 GMT
serv1a$ date -u
Tue Nov 14 11:06:54 UTC 2006

Did you reply an hour after you did the above command? If not, both your machines have the wrong time set.

And as OldSchool and I have asked, how are you making sure the files have the original timestamp when you "transfer" them?
Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,199
Registered: ‎05-29-2000
Message 9 of 21 (526 Views)

Re: Help me read the tztab file

> timestamp changes...

Several things happen when you transfer a file. The local machine with the original file has a timestamp that is based on the current value of $TZ (and that is not necessarily the /etc/TIMEZONE setting). Then, depending on the transfer method, the remote machine may interpret the local timestamp differently. For instance, ftpd inherits the $TZ value from /etc/TIMEZONE but if ftpd were killed and started by someone with a different $TZ value, new files can have a different timestamp.

How are is the file transferred (what command)?
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 10 of 21 (526 Views)

Re: Help me read the tztab file

Hi Dennis, Old School & Bill,

Thank you for you response!!!

I had taken the time from the servers at 11:00 AM. which looked similar with no change.The servers is located in Middle Europe the time is GMT+1.

The file is being transfered using a cronjob with ftpd!!

The cronjob runs constant to check a particular directory for files which needs to be transfered to the other server.

Hope this explains.

Thank you and please let me know how we can go about this.

Any help great appreciated.

Thank you.

Regards,
RDJ
Robert DJ
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 11 of 21 (525 Views)

Re: Help me read the tztab file

sorry its 11:00 AM UTC
Robert DJ
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,855
Registered: ‎03-06-2006
Message 12 of 21 (525 Views)

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
Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,199
Registered: ‎05-29-2000
Message 13 of 21 (525 Views)

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.
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 14 of 21 (525 Views)

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
Please use plain text.
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 15 of 21 (525 Views)

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.





Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,199
Registered: ‎05-29-2000
Message 16 of 21 (525 Views)

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.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,855
Registered: ‎03-06-2006
Message 17 of 21 (525 Views)

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.
Please use plain text.
Frequent Advisor
Robert DJ
Posts: 73
Registered: ‎11-28-2002
Message 18 of 21 (525 Views)

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
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,855
Registered: ‎03-06-2006
Message 19 of 21 (525 Views)

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 ...
Please use plain text.
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 20 of 21 (525 Views)

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

Please use plain text.
Honored Contributor
OldSchool
Posts: 3,372
Registered: ‎09-09-2004
Message 21 of 21 (525 Views)

Re: Help me read the tztab file

Correction

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


Should have read:
/sbin/init.d/inet stop; /sbin/init.d/inet/start




Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation