Understanding your File Timestamps
Vector 11:4, page 121
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 121
I have come across a "feature" of Dyalog APL/W which I thought other Vector readers might be interested in. This feature may not be restricted to Dyalog APL/W.
As each component in a component file is written or updated, its timestamp is also written/updated. The 3rd element of the result of the system function ⎕FRDCI returns this information as "the time of the last update in 60ths of a second since 1st January 1970".
When I recently tried this out, the result returned (after conversion back to time of day) appeared to be 5 hours later than the time reported by the ⎕TS function at the time of the update.
It transpires that unless you tell it otherwise (see later for how) Dyalog APL/W assumes that your clock is set to EST (Eastern standard time).
What ⎕FRDCI returns is elapsed time, with an adjustment for the difference between GMT and local time. This allows files to be transferred between sites in different time zones, and "component saved times" to be compared on an equal basis.
OK then, how do we tell Dyalog APL/W which time zone we are in? Answer: set the DOS environment string TZ to specify the local time zone. (Note, PCs connected to a network should already have TZ set.) In the UK, add the line TZ=GMT0BST into your AUTOEXEC.BAT file.
The standard C library of time functions, relating to Local Time uses this variable whether in UNIX, DOS or Windows, so this may also apply to other APLs written in C. These time functions look for TZ and if they don’t find it, set the time zone information to EST5EDT.
The following extract has been copied out of the Borland C++ on-line help file.
tzset <TIME.H>
UNIX time compatibility; sets daylight, timezone, and tzname
Declaration: void tzset(void);
Remarks:
tzset sets the global variables daylight, timezone, and tzname based on the
environment variable TZ.
ftime and localtime use these variables to correct Greenwich mean time (GMT)
to the local time zone.
This is the format of the TZ environment string:
TZ = zzz[+/-]d[d][lll]
Component What It Represents
==================================
zzz Three-character string representing the name of the current
time zone. All three characters are required.
[+/-]d[d] Required field containing an optionally signed number with
1 or more digits.
This number is the local time zone's difference from GMT in
hours.
Positive numbers adjust westward from GMT.
Negative numbers adjust eastward from GMT.
This number is used in the calculation of timezone.
lll Optional three-character field that represents the local
time zone's daylight saving time.
If this field is present, daylight is set to non-zero.
If this field is absent, daylight is set to 0.
If the TZ environment string isn't present or isn't in the specified form,
tzset presumes a default TZ = "EST5EDT" for the purposes of assigning values
to daylight, timezone, and tzname.
Return Value: None
Portability:
DOS UNIX Windows
Yes Yes Yes
See Also:
asctime ctime ftime gmtime localtime stime time
So, if on your PC, the component time information does not tie in with your time stamp, set your time zone.