diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclClock.c | 9 |
2 files changed, 12 insertions, 4 deletions
@@ -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; |