From 6bcbc3a1d65e342824a86a925d1bbbb42fd4de22 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Mon, 31 Jul 2006 15:44:06 +0000 Subject: Bug 1531530 --- ChangeLog | 7 +++++++ generic/tclClock.c | 9 +++++---- 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 + + * 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 * 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; -- cgit v0.12