# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*- # -- Tcl Module # @@ Meta Begin # Package debug::timestamp 1 # Meta as::build::date 2015-05-25 # Meta as::origin http://sourceforge.net/projects/tcllib # Meta category debug narrative # Meta description debug narrative - timestamping # Meta license BSD # Meta platform tcl # Meta require {Tcl 8.5} # Meta require debug # Meta subject narrative log trace timestamps debug # Meta summary debug::timestamp # @@ Meta End # ACTIVESTATE TEAPOT-PKG BEGIN REQUIREMENTS package require Tcl 8.5 package require debug # ACTIVESTATE TEAPOT-PKG END REQUIREMENTS # ACTIVESTATE TEAPOT-PKG BEGIN DECLARE package provide debug::timestamp 1 # ACTIVESTATE TEAPOT-PKG END DECLARE # ACTIVESTATE TEAPOT-PKG END TM # -*- tcl -* # Debug -- Timestamps. # -- Colin McCormack / originally Wub server utilities # # Generate timestamps for debug messages. # The provided commands are for use in prefixes and headers. # # ## ### ##### ######## ############# ##################### ## Requisites package require Tcl 8.5 package require debug namespace eval ::debug { namespace export timestamp namespace ensemble create } # # ## ### ##### ######## ############# ##################### ## API & Implementation proc ::debug::timestamp {} { variable timestamp::delta variable timestamp::baseline set now [::tcl::clock::milliseconds] if {$delta} { set time "${now}-[expr {$now - $delta}]mS " } else { set time "${now}mS " } set delta $now return $time } # # ## ### ##### ######## ############# ##################### namespace eval ::debug::timestamp { variable delta 0 variable baseline [::tcl::clock::milliseconds] } # # ## ### ##### ######## ############# ##################### ## Ready package provide debug::timestamp 1 return