clock.test fails in time zone +1100 (e.g. Australian Eastern
Deleted219339ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 22 years ago
Descriptionplain2000-10-26 05:10:58
OriginalBugID: 5308 Bug
Version: 8.3
SubmitDate: '2000-05-01'
LastModified: '2000-05-31'
Severity: LOW
Status: UnAssn
Submitter: techsupp
ChangedBy: angie
OS: Linux-Red Hat
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'
Name:
Harvey Davies
CVS:
core-8-3-1
Comments:
Note that there are two (different) "clock-4.18" tests in clock.test!
The first
succesds. The the second begins the series of failing tests ending with
"clock-4.24".
ReproducibleScript:
cd tcl8.3/unix
make test TZ=AEST-11AEDT
ObservedBehavior:
Get following output:
clock.test
==== clock-4.18 clock scan, number meridian FAILED
==== Contents of test case:
set t1 [clock scan "5 am" -base $5amPST -gmt true]
set t2 [clock scan "5 pm" -base $5amPST -gmt true]
set t3 [clock scan "5 a.m." -base $5amPST -gmt true]
set t4 [clock scan "5 p.m." -base $5amPST -gmt true]
list [clock format $t1 -format {%b %d, %Y %H:%M:%S} -gmt true] [clock format $t2 -format {%b %d, %Y %H:%M:%S} -gmt true] [clock format $t3 -format {%b %d, %Y %H:%M:%S} -gmt true] [clock format $t4 -format {%b %d, %Y %H:%M:%S} -gmt true]
---- Result was:
{Jan 01, 2000 05:00:00} {Jan 01, 2000 17:00:00} {Jan 01, 2000 05:00:00} {Jan 01, 2000 17:00:00}
---- Result should have been:
{Dec 31, 1999 05:00:00} {Dec 31, 1999 17:00:00} {Dec 31, 1999 05:00:00} {Dec 31, 1999 17:00:00}
==== clock-4.18 FAILED
==== clock-4.19 clock scan, number:number meridian FAILED
==== Contents of test case:
clock format [clock scan "5:30 pm" -base $5amPST -gmt true] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 17:30:00
---- Result should have been:
Dec 31, 1999 17:30:00
==== clock-4.19 FAILED
==== clock-4.20 clock scan, number:number-timezone FAILED
==== Contents of test case:
clock format [clock scan "00:00-0800" -gmt true -base $5amPST] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 08:00:00
---- Result should have been:
Dec 31, 1999 08:00:00
==== clock-4.20 FAILED
==== clock-4.21 clock scan, number:number:number o_merid FAILED
==== Contents of test case:
clock format [clock scan "8:00:00" -gmt true -base $5amPST] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 08:00:00
---- Result should have been:
Dec 31, 1999 08:00:00
==== clock-4.21 FAILED
==== clock-4.22 clock scan, number:number:number o_merid FAILED
==== Contents of test case:
clock format [clock scan "8:00:00 am" -gmt true -base $5amPST] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 08:00:00
---- Result should have been:
Dec 31, 1999 08:00:00
==== clock-4.22 FAILED
==== clock-4.23 clock scan, number:number:number o_merid FAILED
==== Contents of test case:
clock format [clock scan "8:00:00 pm" -gmt true -base $5amPST] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 20:00:00
---- Result should have been:
Dec 31, 1999 20:00:00
==== clock-4.23 FAILED
==== clock-4.24 clock scan, number:number:number-timezone FAILED
==== Contents of test case:
clock format [clock scan "00:00:30-0800" -gmt true -base $5amPST] -format {%b %d, %Y %H:%M:%S} -gmt true
---- Result was:
Jan 01, 2000 08:00:30
---- Result should have been:
Dec 31, 1999 08:00:30
==== clock-4.24 FAILED
DesiredBehavior:
The only output for this (clock) test should be:
clock.test
Patch:
*** clock.test.old Mon May 1 12:27:57 2000
--- clock.test.new Mon May 1 13:05:49 2000
***************
*** 188,196 ****
} "Oct 23, 1992 00:00:00"
# CLOCK SCAN REAL TESTS
! # We use 5am PST, 31-12-1999 as the base for these scans because irrespective
! # of your local timezone it should always give us times on December 31, 1999
set 5amPST 946645200
test clock-4.18 {clock scan, number meridian} {
set t1 [clock scan "5 am" -base $5amPST -gmt true]
set t2 [clock scan "5 pm" -base $5amPST -gmt true]
--- 188,199 ----
} "Oct 23, 1992 00:00:00"
# CLOCK SCAN REAL TESTS
! # Set time zone to PST (8 hours behind UTC) to ensure date is December 31, 199
9
! # (not the case in time zones 11 or more hours ahead of UTC)
set 5amPST 946645200
+ catch {set oldtz $env(TZ)}
+ set env(TZ) "PST08PDT"
+
test clock-4.18 {clock scan, number meridian} {
set t1 [clock scan "5 am" -base $5amPST -gmt true]
set t2 [clock scan "5 pm" -base $5amPST -gmt true]
***************
*** 227,232 ****
--- 230,239 ----
clock format [clock scan "00:00:30-0800" -gmt true -base $5amPST] \
-format {%b %d, %Y %H:%M:%S} -gmt true
} "Dec 31, 1999 08:00:30"
+
+ # Restore original time zone
+ catch {unset env(TZ); set env(TZ) $oldtz}
+
test clock-4.25 {clock scan, DST for days} {
clock scan "tomorrow" -base [clock scan "19991031 00:00:00"]
} [clock scan "19991101 00:00:00"]
PatchFiles:
tests/clock.test
First, apologies for delay in replying. After trying tcl on four platforms
(Windows, Linux, Solaris, Irix) I have
concluded that there are just too many problems in our time zone. My
proposed solution is to run all
the clock tests with environment TZ set to a safe time zone - I have used
"PST08PDT". My new
universal patch file is as follows:
--- clock.test.oldMon May 1 12:27:57 2000
+++ clock.test.newWed May 31 15:15:49 2000
@@ -17,6 +17,13 @@
namespace import -force ::tcltest::*
}
+# A number of tests fail in time zones which are 11 or more hours ahead of
UTC.
+# So until these problems are fixed, run all clock tests in time zone PST,
+# which is 8 hours behind UTC.
+
+catch {set original_tz $env(TZ)}
+set env(TZ) "PST08PDT"
+
test clock-1.1 {clock tests} {
list [catch {clock} msg] $msg
} {1 {wrong # args: should be "clock option ?arg ...?"}}
@@ -412,6 +419,9 @@
clock format [clock scan "next may" -base [clock scan "june 1, 2000"]]
\
-format %m.%Y
} "05.2001"
+
+# Restore original time zone
+catch {unset env(TZ); set env(TZ) $original_tz}
# cleanup
::tcltest::cleanupTests
-- 05/31/2000 angie
dgp Ticket [219339ffff]: 2 changes
[History diff]2001-02-08 12:25:19
kennykbplain2004-08-19 21:04:40
Logged In: YES user_id=99768 Free-format scan in 8.5 is deprecated in favor of fixed-format scan. In fixed formats, the position of the time zone group is known, and the ambiguity (is +1100 a quantity or a time zone?) goes away. Scanning all the above times with -format specifiers that give the interpretation of the fields has been verified to work.
Log in (anonymous is fine) to add a comment.