Posted to tcl by dkf at Thu Oct 17 19:48:37 GMT 2013view pretty

proc Elapse {startMilliseconds} {
    set nmsecs [expr {[clock milliseconds] - $startMilliseconds}]
    return [format %.03f [expr {$nmsecs/1000.0}]]
}

apply {{} {
    set start [clock milliseconds]
    set fd [open dump.log]
    while {[gets $fd line] != -1} {
        if {[expr {[incr nlines] % 100000}] == 0} {
            puts "$nlines lines, [Elapse $start] seconds passed"
        }
    }
    puts "$nlines lines, [Elapse $start] seconds passed"
}}