[tz] Java & Rearguard
Russ Allbery
eagle at eyrie.org
Thu Jun 6 19:22:22 UTC 2019
scs at eskimo.com (Steve Summit) writes:
> (As an aside: Is it my imagination, or was there a time when C had an
> array of 1, 2, or maybe more than 2 time zone strings, and you used
> tm_isdst as an index into them, such that tm_isdst functioned as a sort
> of an opaque token even though it had "dst" in its name?)
tzname, and it's still a supported API (documented in tzset(3) on Linux).
INN uses it when generating Date headers if it's available and tm.tm_zone
is not (in a bit of portability that is now probably only applicable to
museum exhibitions):
/* Now, get a pointer to the time zone abbreviation, and if there is
enough room in the buffer, add it to the end of the date string as a
comment. */
if (!local) {
tz_name = "UTC";
} else {
#if HAVE_STRUCT_TM_TM_ZONE
tz_name = tm.tm_zone;
#elif HAVE_TZNAME
tz_name = tzname[(tm.tm_isdst > 0) ? 1 : 0];
#else
tz_name = NULL;
#endif
}
tzset(3):
The tzset() function initializes the tzname variable from the TZ
environment variable. This function is automatically called by the
other time conversion functions that depend on the timezone. In a
System-V-like environment, it will also set the variables timezone
(seconds West of UTC) and daylight (to 0 if this timezone does not
have any daylight saving time rules, or to nonzero if there is a time,
past, present or future when daylight saving time applies).
--
Russ Allbery (eagle at eyrie.org) <http://www.eyrie.org/~eagle/>
More information about the tz
mailing list