diff options
author | andreask <andreask> | 2013-01-22 19:24:25 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:24:25 (GMT) |
commit | 6d8a36d84d2843681302604a082e2f787c3c3674 (patch) | |
tree | 9d3b4ee05189203cf7ce94b4b2a6d2d911aaa18d /tests/winTime.test | |
parent | 296aebbd6ee092a25741684fa37ee31ef5a3e222 (diff) | |
download | tcl-6d8a36d84d2843681302604a082e2f787c3c3674.zip tcl-6d8a36d84d2843681302604a082e2f787c3c3674.tar.gz tcl-6d8a36d84d2843681302604a082e2f787c3c3674.tar.bz2 |
Contribution by Patrick Fradin <patrick.fradin@planar.com>
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'tests/winTime.test')
-rw-r--r-- | tests/winTime.test | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/winTime.test b/tests/winTime.test index add8f98..ceeca55 100644 --- a/tests/winTime.test +++ b/tests/winTime.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -if {[lsearch [namespace children] ::tcltest] == -1} { +if {"::tcltest" ni [namespace children]} { package require tcltest namespace import -force ::tcltest::* } @@ -45,18 +45,18 @@ test winTime-2.1 {Synchronization of Tcl and Windows clocks} {testwinclock} { # http://support.microsoft.com/default.aspx?scid=kb;en-us;274323 set failed {} set ok 1 - foreach start_sec [testwinclock] break + lassign [testwinclock] start_sec while { 1 } { - foreach { sys_sec sys_usec tcl_sec tcl_usec } [testwinclock] break + lassign [testwinclock] sys_sec sys_usec tcl_sec tcl_usec set diff [expr { $tcl_sec - $sys_sec - + 1.0e-6 * ( $tcl_usec - $sys_usec ) }] + + (1.0e-6 * ( $tcl_usec - $sys_usec )) }] if { abs($diff) > 0.06 } { set failed "Tcl clock differs from system clock by $diff sec" break } else { testwinsleep 1 } - if { $sys_sec - $start_sec >= 30 } break + if { ($sys_sec - $start_sec) >= 30 } break } set failed } {} |