summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-09-08 15:38:28 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-09-08 15:38:28 (GMT)
commit30204f6dca832947b87b204f4fb74bccbd0be640 (patch)
tree46ac560d77a5ba621f11e75736f2c19ba8a94fac
parent81f39c521013b8e14be326102c01400789e50150 (diff)
downloadtcl-30204f6dca832947b87b204f4fb74bccbd0be640.zip
tcl-30204f6dca832947b87b204f4fb74bccbd0be640.tar.gz
tcl-30204f6dca832947b87b204f4fb74bccbd0be640.tar.bz2
* generic/tclClock.c (TclClockMktimeObjCmd): Fixed a bug where
the month was scanned incorrectly in -timezone :localtime. * tests/clock.test (clock-40.1): Added regression test case for the bug where month was scanned incorrectly in -timezone :localtime.
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclClock.c4
-rw-r--r--tests/clock.test23
3 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 35c76c5..99f44b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
* doc/clock.n: Corrected a buglet in the header information.
[Bug 1024058]
+ * generic/tclClock.c (TclClockMktimeObjCmd): Fixed a bug where
+ the month was scanned incorrectly in -timezone :localtime.
+ * tests/clock.test (clock-40.1): Added regression test case for
+ the bug where month was scanned incorrectly in -timezone :localtime.
2004-09-07 David Gravereaux <davygrvy@pobox.com>
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 3fa51ae..e348d58 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.30 2004/08/18 21:29:12 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.31 2004/09/08 15:38:33 kennykb Exp $
*/
#include "tclInt.h"
@@ -239,7 +239,7 @@ TclClockMktimeObjCmd( ClientData clientData,
if ( Tcl_GetIntFromObj( interp, objv[2], &i ) != TCL_OK ) {
return TCL_ERROR;
}
- toConvert.tm_mon = i;
+ toConvert.tm_mon = i - 1;
if ( Tcl_GetIntFromObj( interp, objv[3], &i ) != TCL_OK ) {
return TCL_ERROR;
}
diff --git a/tests/clock.test b/tests/clock.test
index 0fa42b6..15647d9 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.test,v 1.40 2004/09/07 17:38:59 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.41 2004/09/08 15:38:35 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -35236,6 +35236,27 @@ test clock-39.1 {regression - synonym timezones} {
clock format 0 -format {%H:%M:%S} -timezone :US/Eastern
} {19:00:00}
+test clock-40.1 {regression - bad month with -timezone :localtime} \
+ -setup {
+ if { [info exists env(TZ)] } {
+ set oldTZ $env(TZ)
+ }
+ set env(TZ) UTC0
+ } \
+ -body {
+ clock scan 1970-01-01T00:00:00 -timezone :localtime \
+ -format %Y-%m-%dT%H:%M:%S
+ } \
+ -cleanup {
+ if { [info exists oldTZ] } {
+ set env(TZ) $oldTZ
+ unset oldTZ
+ } else {
+ unset env(TZ)
+ }
+ } \
+ -result {0}
+
# cleanup
namespace delete ::testClock