diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-27 17:45:31 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-27 17:45:31 +0000 |
commit | 8d65c00a43d84ed465e61b8885770992837db60b (patch) | |
tree | 0dc39bbc1e9c9595e6a3fa1413acb30cb34fe6cd | |
parent | cf854f9c0722d458817bee1cd920d617956a4c33 (diff) |
Update to tzcode2010m from elsie.nci.nih.gov
-rw-r--r-- | lib/libc/time/zic.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c index a9915c40034..a8f6086f30e 100644 --- a/lib/libc/time/zic.c +++ b/lib/libc/time/zic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zic.c,v 1.32 2010/08/23 22:35:34 millert Exp $ */ +/* $OpenBSD: zic.c,v 1.33 2010/09/27 17:45:30 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2006-07-17 by Arthur David Olson. @@ -1593,6 +1593,52 @@ const char * const string; if (thistimei == 0) writetype[0] = TRUE; } +#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH + /* + ** For some pre-2011 systems: if the last-to-be-written + ** standard (or daylight) type has an offset different from the + ** most recently used offset, + ** append an (unused) copy of the most recently used type + ** (to help get global "altzone" and "timezone" variables + ** set correctly). + */ + { + register int mrudst, mrustd, hidst, histd, type; + + hidst = histd = mrudst = mrustd = -1; + for (i = thistimei; i < thistimelim; ++i) + if (isdsts[types[i]]) + mrudst = types[i]; + else mrustd = types[i]; + for (i = 0; i < typecnt; ++i) + if (writetype[i]) + if (isdsts[i]) + hidst = i; + else histd = i; + if (hidst >= 0 && mrudst >= 0 && hidst != mrudst && + gmtoffs[hidst] != gmtoffs[mrudst]) { + isdsts[mrudst] = -1; + type = addtype(gmtoffs[mrudst], + &chars[abbrinds[mrudst]], + TRUE, + ttisstds[mrudst], + ttisgmts[mrudst]); + isdsts[mrudst] = TRUE; + writetype[type] = TRUE; + } + if (histd >= 0 && mrustd >= 0 && histd != mrustd && + gmtoffs[histd] != gmtoffs[mrustd]) { + isdsts[mrustd] = -1; + type = addtype(gmtoffs[mrustd], + &chars[abbrinds[mrustd]], + FALSE, + ttisstds[mrustd], + ttisgmts[mrustd]); + isdsts[mrustd] = FALSE; + writetype[type] = TRUE; + } + } +#endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ thistypecnt = 0; for (i = 0; i < typecnt; ++i) typemap[i] = writetype[i] ? thistypecnt++ : -1; |