Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-04-18 23:07:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-04-18 23:07:18 +0400
commit593d0dc50fd0c9dad144f64f8ee14916ebb7f87d (patch)
tree1c50679a79b6b27a392c0e8832be6406b086ddf8 /winsup/cygwin/localtime.cc
parent1d8170bdfa667f437d870b841b89f3f5bf029fe3 (diff)
* localtime.cc (tzload): Don't change global timezone information
when called from gmtime or gmtime_r. (tzparse): Ditto.
Diffstat (limited to 'winsup/cygwin/localtime.cc')
-rw-r--r--winsup/cygwin/localtime.cc40
1 files changed, 26 insertions, 14 deletions
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
index afa118080..239aaffdd 100644
--- a/winsup/cygwin/localtime.cc
+++ b/winsup/cygwin/localtime.cc
@@ -866,10 +866,13 @@ tzload(const char *name, struct state *sp)
}
}
}
- __gettzinfo ()->__tzrule[0].offset
- = -sp->ttis[1].tt_gmtoff;
- __gettzinfo ()->__tzrule[1].offset
- = -sp->ttis[0].tt_gmtoff;
+ if (sp == lclptr)
+ {
+ __gettzinfo ()->__tzrule[0].offset
+ = -sp->ttis[1].tt_gmtoff;
+ __gettzinfo ()->__tzrule[1].offset
+ = -sp->ttis[0].tt_gmtoff;
+ }
return 0;
}
@@ -1243,10 +1246,13 @@ tzparse(const char *name, struct state *sp, const int lastditch)
janfirst += year_lengths[isleap(year)] *
SECSPERDAY;
}
- __gettzinfo ()->__tzrule[0].offset
- = -sp->ttis[1].tt_gmtoff;
- __gettzinfo ()->__tzrule[1].offset
- = -sp->ttis[0].tt_gmtoff;
+ if (sp == lclptr)
+ {
+ __gettzinfo ()->__tzrule[0].offset
+ = -sp->ttis[1].tt_gmtoff;
+ __gettzinfo ()->__tzrule[1].offset
+ = -sp->ttis[0].tt_gmtoff;
+ }
} else {
register long theirstdoffset;
register long theirdstoffset;
@@ -1333,10 +1339,13 @@ tzparse(const char *name, struct state *sp, const int lastditch)
sp->ttis[1].tt_isdst = true;
sp->ttis[1].tt_abbrind = stdlen + 1;
sp->typecnt = 2;
- __gettzinfo ()->__tzrule[0].offset
- = -sp->ttis[0].tt_gmtoff;
- __gettzinfo ()->__tzrule[1].offset
- = -sp->ttis[1].tt_gmtoff;
+ if (sp == lclptr)
+ {
+ __gettzinfo ()->__tzrule[0].offset
+ = -sp->ttis[0].tt_gmtoff;
+ __gettzinfo ()->__tzrule[1].offset
+ = -sp->ttis[1].tt_gmtoff;
+ }
}
} else {
dstlen = 0;
@@ -1345,8 +1354,11 @@ tzparse(const char *name, struct state *sp, const int lastditch)
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = 0;
sp->ttis[0].tt_abbrind = 0;
- __gettzinfo ()->__tzrule[0].offset = -sp->ttis[0].tt_gmtoff;
- __gettzinfo ()->__tzrule[1].offset = -sp->ttis[0].tt_gmtoff;
+ if (sp == lclptr)
+ {
+ __gettzinfo ()->__tzrule[0].offset = -sp->ttis[0].tt_gmtoff;
+ __gettzinfo ()->__tzrule[1].offset = -sp->ttis[0].tt_gmtoff;
+ }
}
sp->charcnt = stdlen + 1;
if (dstlen != 0)