summaryrefslogtreecommitdiff
path: root/elsie.nci.nih.gov/src/localtime.c
diff options
context:
space:
mode:
authorStuart Bishop <stuart@stuartbishop.net>2013-03-15 00:25:57 +0700
committerStuart Bishop <stuart@stuartbishop.net>2013-03-15 00:25:57 +0700
commit42126f388e988569e2312e7a5f8d79b2e2af7c30 (patch)
tree70466310432e7bd3ffb2ce25d462dd8b6b0405ae /elsie.nci.nih.gov/src/localtime.c
parentc8da7e96300d943f9a9fc514007fdd10840a4637 (diff)
downloadpytz-42126f388e988569e2312e7a5f8d79b2e2af7c30.tar.gz
Import 2013b release
Diffstat (limited to 'elsie.nci.nih.gov/src/localtime.c')
-rw-r--r--elsie.nci.nih.gov/src/localtime.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/elsie.nci.nih.gov/src/localtime.c b/elsie.nci.nih.gov/src/localtime.c
index e074c54..47b2323 100644
--- a/elsie.nci.nih.gov/src/localtime.c
+++ b/elsie.nci.nih.gov/src/localtime.c
@@ -271,6 +271,11 @@ settzname(void)
/*
** And to get the latest zone names into tzname. . .
*/
+ for (i = 0; i < sp->typecnt; ++i) {
+ register const struct ttinfo * const ttisp = &sp->ttis[i];
+
+ tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind];
+ }
for (i = 0; i < sp->timecnt; ++i) {
register const struct ttinfo * const ttisp =
&sp->ttis[
@@ -479,20 +484,31 @@ tzload(register const char *name, register struct state *const sp,
** signed time_t system but using a data file with
** unsigned values (or vice versa).
*/
- for (i = 0; i < sp->timecnt - 2; ++i)
- if (sp->ats[i] > sp->ats[i + 1]) {
- ++i;
+ for (i = 0; i < sp->timecnt; ++i)
+ if ((i < sp->timecnt - 1 &&
+ sp->ats[i] > sp->ats[i + 1]) ||
+ (i == sp->timecnt - 1 && !TYPE_SIGNED(time_t) &&
+ sp->ats[i] >
+ ((stored == 4) ? INT32_MAX : INT64_MAX))) {
if (TYPE_SIGNED(time_t)) {
/*
** Ignore the end (easy).
*/
- sp->timecnt = i;
+ sp->timecnt = i + 1;
} else {
/*
** Ignore the beginning (harder).
*/
register int j;
+ /*
+ ** Keep the record right before the
+ ** epoch boundary,
+ ** but tweak it so that it starts
+ ** right with the epoch
+ ** (thanks to Doug Bailey).
+ */
+ sp->ats[i] = 0;
for (j = 0; j + i < sp->timecnt; ++j) {
sp->ats[j] = sp->ats[j + i];
sp->types[j] = sp->types[j + i];