diff options
Diffstat (limited to 'main/stdtime/localtime.c')
-rw-r--r-- | main/stdtime/localtime.c | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c index 5b5526e6f..f8050c95c 100644 --- a/main/stdtime/localtime.c +++ b/main/stdtime/localtime.c @@ -1057,7 +1057,7 @@ static int tzload(const char *name, struct state * const sp, const int doextend) int result; /* for temporary struct state -- - * macro flags the the struct as a stack temp. + * macro flags the struct as a stack temp. * to prevent use within add_notify() */ SP_STACK_INIT(ts); @@ -1508,16 +1508,14 @@ static int tzparse(const char *name, struct state *sp, const int lastditch) } } else { long theirstdoffset; - long theirdstoffset; long theiroffset; - int isdst; int i; int j; if (*name != '\0') return -1; /* - ** Initial values of theirstdoffset and theirdstoffset. + ** Initial values of theirstdoffset. */ theirstdoffset = 0; for (i = 0; i < sp->timecnt; ++i) { @@ -1528,19 +1526,6 @@ static int tzparse(const char *name, struct state *sp, const int lastditch) break; } } - theirdstoffset = 0; - for (i = 0; i < sp->timecnt; ++i) { - j = sp->types[i]; - if (sp->ttis[j].tt_isdst) { - theirdstoffset = - -sp->ttis[j].tt_gmtoff; - break; - } - } - /* - ** Initially we're assumed to be in standard time. - */ - isdst = FALSE; theiroffset = theirstdoffset; /* ** Now juggle transition times and types @@ -1552,32 +1537,13 @@ static int tzparse(const char *name, struct state *sp, const int lastditch) if (sp->ttis[j].tt_ttisgmt) { /* No adjustment to transition time */ } else { - /* - ** If summer time is in effect, and the - ** transition time was not specified as - ** standard time, add the summer time - ** offset to the transition time; - ** otherwise, add the standard time - ** offset to the transition time. - */ - /* - ** Transitions from DST to DDST - ** will effectively disappear since - ** POSIX provides for only one DST - ** offset. - */ - if (isdst && !sp->ttis[j].tt_ttisstd) { - sp->ats[i] += dstoffset - - theirdstoffset; - } else { - sp->ats[i] += stdoffset - - theirstdoffset; - } + /* Add the standard time offset to the transition time. */ + sp->ats[i] += stdoffset - theirstdoffset; } theiroffset = -sp->ttis[j].tt_gmtoff; - if (sp->ttis[j].tt_isdst) - theirdstoffset = theiroffset; - else theirstdoffset = theiroffset; + if (!sp->ttis[j].tt_isdst) { + theirstdoffset = theiroffset; + } } /* ** Finally, fill in ttis. @@ -1811,7 +1777,7 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_ return; /* If the desired time exceeds the bounds of the defined time transitions - * then give give up on determining DST info and simply look for gmt offset + * then give up on determining DST info and simply look for gmt offset * This requires that I adjust the given time using increments of Gregorian * repeats to place the time within the defined time transitions in the * timezone structure. @@ -2587,4 +2553,3 @@ char *ast_strptime(const char *s, const char *format, struct ast_tm *tm) { return ast_strptime_locale(s, format, tm, NULL); } - |