summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-07-31 15:44:06 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-07-31 15:44:06 (GMT)
commit6bcbc3a1d65e342824a86a925d1bbbb42fd4de22 (patch)
treea75575091f37f74a14d383828205d4d0da1f220f
parent3da9c09d810510b812376df89e54ef578a4571d4 (diff)
downloadtcl-6bcbc3a1d65e342824a86a925d1bbbb42fd4de22.zip
tcl-6bcbc3a1d65e342824a86a925d1bbbb42fd4de22.tar.gz
tcl-6bcbc3a1d65e342824a86a925d1bbbb42fd4de22.tar.bz2
Bug 1531530
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclClock.c9
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index b32a62a..2846f73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-31 Kevin Kenny <kennykb@acm.org>
+
+ * generic/tclClock.c (ConvertLocalToUTCUsingC):
+ Corrected a regression that caused dates before 1969 to be
+ one day off in the :localtime time zone if TZ is not set.
+ [Bug 1531530]
+
2006-07-30 Kevin Kenny <kennykb@acm.org>
* generic/tclClock.c (GetJulianDayFromEraYearMonthDay):
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 655dedc..ee0291e 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclClock.c,v 1.52 2006/07/31 03:27:12 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.53 2006/07/31 15:44:06 kennykb Exp $
*/
#include "tclInt.h"
@@ -792,14 +792,15 @@ ConvertLocalToUTCUsingC(
struct tm timeVal;
int localErrno;
int secondOfDay;
+ Tcl_WideInt jsec;
/*
* Convert the given time to a date.
*/
- fields->julianDay = (int) ((fields->localSeconds + JULIAN_SEC_POSIX_EPOCH)
- / SECONDS_PER_DAY);
- secondOfDay = (int)(fields->localSeconds % SECONDS_PER_DAY);
+ jsec = fields->localSeconds + JULIAN_SEC_POSIX_EPOCH;
+ fields->julianDay = (int) (jsec / SECONDS_PER_DAY);
+ secondOfDay = (int)(jsec % SECONDS_PER_DAY);
if (secondOfDay < 0) {
secondOfDay += SECONDS_PER_DAY;
--fields->julianDay;