* localtime.cc (tzload): Fix loading latest timezone offsets into

tzinfo from zoneinfo files.  Add comment to explain what we do.
	(tzparse): Add more comments to explain in case of loading timezone
	offset from other sources.
This commit is contained in:
Corinna Vinschen 2015-01-07 21:27:22 +00:00
parent 6a35dbf342
commit 80d9bfa9a8
3 changed files with 2769 additions and 2747 deletions

File diff suppressed because it is too large Load Diff

2745
winsup/cygwin/ChangeLog-2014 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -900,12 +900,18 @@ tzload(timezone_t sp, const char *name, const int doextend)
}
}
free(up);
/*
** Get latest zone offsets into tzinfo (for newlib). . .
*/
if (sp == lclptr)
{
__gettzinfo ()->__tzrule[0].offset
= -sp->ttis[1].tt_gmtoff;
__gettzinfo ()->__tzrule[1].offset
= -sp->ttis[0].tt_gmtoff;
for (i = 0; i < sp->timecnt; ++i)
{
const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
__gettzinfo ()->__tzrule[ttisp->tt_isdst].offset
= -ttisp->tt_gmtoff;
}
}
return 0;
oops:
@ -1355,6 +1361,9 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
break;
janfirst = newfirst;
}
/*
** Get zone offsets into tzinfo (for newlib). . .
*/
if (sp == lclptr)
{
__gettzinfo ()->__tzrule[0].offset
@ -1447,6 +1456,9 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
sp->ttis[1].tt_isdst = TRUE;
sp->ttis[1].tt_abbrind = (int)(stdlen + 1);
sp->typecnt = 2;
/*
** Get zone offsets into tzinfo (for newlib). . .
*/
if (sp == lclptr)
{
__gettzinfo ()->__tzrule[0].offset
@ -1463,6 +1475,9 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = 0;
sp->ttis[0].tt_abbrind = 0;
/*
** Get zone offsets into tzinfo (for newlib). . .
*/
if (sp == lclptr)
{
__gettzinfo ()->__tzrule[0].offset = -sp->ttis[0].tt_gmtoff;