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>2009-06-12 19:06:26 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-06-12 19:06:26 +0400
commit7ce08eab6cd20d48d83167bfb48c272cabfe5c2b (patch)
tree09debd5abdef81c92ff2719efa270f22c647a475
parent06391373b0551f7aa195693baa934f1db2f64a18 (diff)
* localtime.cc (time2): Add workaround for spring gap problem. Add
explaining comment.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/localtime.cc23
2 files changed, 27 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 01ffd362d..1723b188c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2009-06-12 Corinna Vinschen <corinna@vinschen.de>
+ * localtime.cc (time2): Add workaround for spring gap problem. Add
+ explaining comment.
+
+2009-06-12 Corinna Vinschen <corinna@vinschen.de>
+
* Makefile.in (SUBLIBS): Add librt.a.
(librt.a): New rule to build librt.a.
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
index 6c05851bd..aa0f735ee 100644
--- a/winsup/cygwin/localtime.cc
+++ b/winsup/cygwin/localtime.cc
@@ -1989,7 +1989,28 @@ time2(struct tm *tmp, void (*funcp) P((const time_t*, long, struct tm*)),
** If that fails, try with normalization of seconds.
*/
t = time2sub(tmp, funcp, offset, okayp, false);
- return *okayp ? t : time2sub(tmp, funcp, offset, okayp, true);
+ if (*okayp)
+ return t;
+ t = time2sub(tmp, funcp, offset, okayp, true);
+ if (*okayp)
+ return t;
+ /* Workaround for the spring gap problem which results in the
+ autoconf mktime usability test failing.
+ What we do here is this: The gap has 3600 seconds. If we
+ subtract 3600 from the tm_sec value and get a valid result,
+ then we can simply add 3600 to the return value and are done.
+ If the result is still not valid, the problem is not the
+ spring gap and we can give up. */
+ struct tm tmp2 = *tmp;
+ tmp2.tm_sec -= 3600;
+ t = time2sub(&tmp2, funcp, offset, okayp, true);
+ if (*okayp)
+ {
+ if (t + 3600 < t) /* Sanity check */
+ return WRONG;
+ return t + 3600;
+ }
+ return t;
}
static time_t