Tcl Source Code

Artifact [5e789bfb4f]
Login

Artifact 5e789bfb4f95d2cd7b4cf47cb3b8c54c7cd48163:

Attachment "cmdah.diff" to ticket [760768ffff] added by hgiese 2003-06-26 03:56:27.
--- ./tcl.org/tests/cmdah.test	Mon May 12 22:51:46 2003
+++ ./tcl/tests/cmdah.test	Wed Jun 25 18:52:56 2003
@@ -32,6 +32,18 @@
 set cmdAHwd [pwd]
 catch {set platform [testgetplatform]}
 
+# wait for the rollover into an even (!) second
+proc waitEvenSec {} {
+    set start1 [clock seconds]
+    while { 1 } {
+        set start2 [clock seconds]
+        if { $start2 != $start1 && !($start2 & 0x01) } {break}
+        after 50
+    }
+    return
+}
+
+
 test cmdAH-0.1 {Tcl_BreakObjCmd, errors} {
     list [catch {break foo} msg] $msg
 } {1 {wrong # args: should be "break"}}
@@ -1330,16 +1342,17 @@
 # completely horrible "keep on trying to write until you managed to do
 # it all in less than a second."  - DKF
 test cmdAH-24.2 {Tcl_FileObjCmd: mtime} {
+    waitEvenSec         ;# be nice to Win9x users
     set f [open $gorpfile w]
     puts $f "More text"
-    set localOld [clock seconds]
     close $f
+    set localOld [clock seconds]
     set old [file mtime $gorpfile]
     after 2000
     set f [open $gorpfile w]
     puts $f "More text"
-    set localNew [clock seconds]
     close $f
+    set localNew [clock seconds]
     set new [file mtime $gorpfile]
     expr {
 	($new > $old) && ($localNew > $localOld) &&
@@ -1379,20 +1392,22 @@
     list [catch {file mtime $file notint} msg] $msg
 } {1 {expected integer but got "notint"}}
 test cmdAH-24.8 {Tcl_FileObjCmd: mtime touch} {
+    waitEvenSec         ;# be nice to Win9x users
     set mtime [file mtime $file]
-    after 1100; # pause a sec to notice change in mtime
+    after 2100; # pause 2 sec (for Win9x) to notice change in mtime
     set newmtime [clock seconds]
     set modmtime [file mtime $file $newmtime]
     expr {$newmtime == $modmtime ? 1 : "$newmtime != $modmtime"}
 } 1
 test cmdAH-24.9 {Tcl_FileObjCmd: mtime touch with non-ascii chars} {
+    waitEvenSec         ;# be nice to Win9x users
     set oldfile $file
     # introduce some non-ascii characters.
     append file \u2022
     file delete -force $file
     file rename $oldfile $file
     set mtime [file mtime $file]
-    after 1100; # pause a sec to notice change in mtime
+    after 2100; # pause 2 sec (for Win9x) to notice change in mtime
     set newmtime [clock seconds]
     set err [catch {file mtime $file $newmtime} modmtime]
     file rename $file $oldfile