This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Process timer

Help for those learning Tcl or writing their own scripts.
Post Reply
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Process timer

Post by ShavdApe »

Im looking to time how long a process takes, so that it can say search took xx seconds for eg.

I can get it to give me in seconds but since some will complete in less than a second I was wondering how to get miliseconds any help appreciated.

* edit *

I think i figured it out but please tell me if this is wrong

set starttime [clock clicks -milliseconds]

... what to time goes here

set endtime [clock clicks -milliseconds]

set timems "([expr $endtime - $starttime] ms)"

and $timems would be my time in miliseconds.

I hope thats correct as I say please let me know if im wrong.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

That should work. You might encounter the occasional situation when the millisecond value overlaps, yielding a negative "duration" though..
NML_375
Post Reply