From df18ecdce0832c7722af0396d30c814d1cebe3a3 Mon Sep 17 00:00:00 2001 From: gahr Date: Tue, 3 May 2016 19:50:15 +0000 Subject: =?UTF-8?q?Approximate=20ms=20by=20=CE=BCs/1000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/tcltest/tcltest.tcl | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 3d8ae5f..1ba3c41 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -1984,11 +1984,8 @@ proc tcltest::test {name description args} { if {!$setupFailure} { # Register startup time - if {[IsVerbose msec]} { - set msStart [clock milliseconds] - } - if {[IsVerbose usec]} { - set usStart [clock microseconds] + if {[IsVerbose msec] || [IsVerbose usec]} { + set timeStart [clock microseconds] } # Verbose notification of $body start @@ -2095,13 +2092,14 @@ proc tcltest::test {name description args} { } } - if {[IsVerbose msec]} { - set elapsed [expr {[clock milliseconds] - $msStart}] - puts [outputChannel] "++++ $name took $elapsed ms" - } - if {[IsVerbose usec]} { - set elapsed [expr {[clock microseconds] - $usStart}] - puts [outputChannel] "++++ $name took $elapsed μs" + if {[IsVerbose msec] || [IsVerbose usec]} { + set t [expr {[clock microseconds] - $timeStart}] + if {[IsVerbose usec]} { + puts [outputChannel] "++++ $name took $t μs" + } + if {[IsVerbose msec]} { + puts [outputChannel] "++++ $name took [expr {round($t/1000.)}] ms" + } } # if we didn't experience any failures, then we passed -- cgit v0.12