On Jun 5, 2019, at 7:33 PM, Steve Summit <scs@eskimo.com> wrote:
(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?)
OK, time for another source dive! V7: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/libc/gen/timezone.c had a timezone() function, which took an offset-in-minutes-from-UTC-with-west-of-UTC-being-positive argument and a "is this DST" argument, and looked up the zone in a table of North American time zone abbreviation names and returned either the result or, if it wasn't found, a string of the form "GMT{+,-}H:MM, with + being east of UTC and - being west of UTC. 4.2BSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/lib/libc/gen/ti... offered the same API, added some European and Australian time zones to the table, and allowed a TZNAME environment variable, of the form "std,dst", to be used to set the zone name. Dating back at least as far as System III: https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII/usr/src/lib/libc/pdp11/... the System Roman Numeral list of UNIXes had the tzname[] array, with 2 elements, the first of which was for "standard" time and the second of which was for "daylight saving" time. The System III man page for ctime(): https://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII/usr/src/man/man3/ctime.... doesn't explicitly say that you use tm_isdst as an index into tzname[], or that the first element is for "standard" time and the second is for "daylight saving" time, but char *tzname[2] = {"EST", "EDT"}; somewhat suggests the latter. The System Roman Numeral mechanism for getting the time zone name is what POSIX adopted.