summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/localtime.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-01-07 21:27:22 +0000
committerCorinna Vinschen <corinna@vinschen.de>2015-01-07 21:27:22 +0000
commit80d9bfa9a8e9dbd20ff07c87a1e46c53af580f48 (patch)
tree563a7b7ffed8c6a807c90ac2277ba75e2bf68b86 /winsup/cygwin/localtime.cc
parent6a35dbf342834de0b8b590b7dcfaccba108acc09 (diff)
downloadcygnal-80d9bfa9a8e9dbd20ff07c87a1e46c53af580f48.tar.gz
cygnal-80d9bfa9a8e9dbd20ff07c87a1e46c53af580f48.tar.bz2
cygnal-80d9bfa9a8e9dbd20ff07c87a1e46c53af580f48.zip
* 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.
Diffstat (limited to 'winsup/cygwin/localtime.cc')
-rw-r--r--winsup/cygwin/localtime.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
index 139faced8..6cbdfed4c 100644
--- a/winsup/cygwin/localtime.cc
+++ b/winsup/cygwin/localtime.cc
@@ -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;