On Dec 9, 2009, at 10:15 AM, Bill Seymour wrote:
I was NOT asking about the number of local time types.
You were asking what the index was. I was indicating how you can infer, from what tzfile.h says, that "indexed by type" does, in fact, mean "having the same index as the type"; that inference involves knowing that noticing that tzh_typecnt is the number of local time types. I also indicated that the tzfile man page could also be used; it says Then there are tzh_ttisstdcnt standard/wall indicators, each stored as a one-byte value; they tell whether the transition times associated with local time types were specified as standard time or wall clock time, and are used when a time zone file is used in handling POSIX-style time zone environment variables. Finally there are tzh_ttisgmtcnt UTC/local indicators, each stored as a one-byte value; they tell whether the transition times associated with local time types were specified as UTC or local time, and are used when a time zone file is used in handling POSIX-style time zone environment variables. but that's unfortunately incomplete. In fact, tzh_ttisstdcnt and tzh_ttisgmtcnt must either be zero or equal to tzh_typecnt (this is enforced by the code that reads the file). If tzh_ttisstdcnt is zero, the array is implicitly "all specified as wall-clock time"; if tzh_ttisgmtcnt is zero, the array is implicitly "all specified as local time".
I was NOT asking about the difference between standard time and DST.
You said
If so, how do I calculate standard time while DST is being observed
If by "how do I calculate standard time while DST is being observed" you mean that you have a time_t value and you want to find out, within a given time zone, what the time would be if DST *weren't* being observed, that means that you need the time zone offset for the first entry before the current entry that is an entry for standard time rather than DST (which, contrary to my previous mail, isn't *necessarily* the previous entry, as there's no guarantee that the previous entry won't be for DST as well - unlikely, but not impossible).
I was NOT asking how to make POSIX TZ strings.
You were asking what "are used when a time zone file is used in handling POSIX-style time zone environment variables" means, and I was explaining under what circumstances a time zone file is used in handling POSIX-style time zone environment variables - it's used when a POSIX TZ string doesn't give any rules. I gave the information of what a "rule" is to clarify what "doesn't give any rules" means - a string such as "EST5EDT" doesn't give any rules. That also means that the Booleans are not used for time zone files other than the posixrules file. It does *not* mean that, in all cases, the transition times are the ones in the TZ variable; the only time when the transition times are the ones in the TZ variable is when the TZ variable includes a rule or rules, not when it refers to a file or when it has a setting such as "PST8PDT" with no rules.