diff options
author | Arch Librarian <arch@canonical.com> | 2005-05-10 20:55:53 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2005-05-10 20:55:53 +0000 |
commit | 11daf4bebca9db224d9060d3d6caeeb552733853 (patch) | |
tree | 780b026f883c7bb2b86350383e1bafd17328c08d /elsie.nci.nih.gov/src/localtime.c | |
parent | 0bfb313141a5307d3cd3023a68e5c1d47cfd79e8 (diff) | |
download | pytz-11daf4bebca9db224d9060d3d6caeeb552733853.tar.gz |
2004a revision of Olsen database and code
Author: zenzen
Date: 2004-05-29 13:26:05 GMT
2004a revision of Olsen database and code
Diffstat (limited to 'elsie.nci.nih.gov/src/localtime.c')
-rw-r--r-- | elsie.nci.nih.gov/src/localtime.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/elsie.nci.nih.gov/src/localtime.c b/elsie.nci.nih.gov/src/localtime.c index 72c0f2b..33dcd5d 100644 --- a/elsie.nci.nih.gov/src/localtime.c +++ b/elsie.nci.nih.gov/src/localtime.c @@ -5,7 +5,7 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)localtime.c 7.76"; +static char elsieid[] = "@(#)localtime.c 7.78"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -1053,8 +1053,9 @@ const time_t * const timep; } /* - * Re-entrant version of localtime - */ +** Re-entrant version of localtime. +*/ + struct tm * localtime_r(timep, tm) const time_t * const timep; @@ -1113,8 +1114,9 @@ const time_t * const timep; } /* - * Re-entrant version of gmtime - */ +* Re-entrant version of gmtime. +*/ + struct tm * gmtime_r(timep, tm) const time_t * const timep; @@ -1503,6 +1505,11 @@ const long offset; register time_t t; register const struct state * sp; register int samei, otheri; + register int sameind, otherind; + register int i; + register int nseen; + int seen[TZ_MAX_TYPES]; + int types[TZ_MAX_TYPES]; int okay; if (tmp->tm_isdst > 1) @@ -1536,10 +1543,20 @@ const long offset; if (sp == NULL) return WRONG; #endif /* defined ALL_STATE */ - for (samei = sp->typecnt - 1; samei >= 0; --samei) { + for (i = 0; i < sp->typecnt; ++i) + seen[i] = FALSE; + nseen = 0; + for (i = sp->timecnt - 1; i >= 0; --i) + if (!seen[sp->types[i]]) { + seen[sp->types[i]] = TRUE; + types[nseen++] = sp->types[i]; + } + for (sameind = 0; sameind < nseen; ++sameind) { + samei = types[sameind]; if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) continue; - for (otheri = sp->typecnt - 1; otheri >= 0; --otheri) { + for (otherind = 0; otherind < nseen; ++otherind) { + otheri = types[otherind]; if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) continue; tmp->tm_sec += sp->ttis[otheri].tt_gmtoff - |