dash007 Posted May 25, 2005 Posted May 25, 2005 Hi, I noticed in the help file there is sort of a stopwatch function. However it shows hour:minute:second. Anyone know how to have micro/milli seconds (not sure of the exact name). Also I am hoping down the track to implement a start/stop/ reset option. Anyone know if this has been done. Any help is appreciated. Cheers
Lazycat Posted May 25, 2005 Posted May 25, 2005 "hour:minute:second"? Maybe you mean TimerInit/TimerDiff function? But these functions works with milliseconds, so I think that what you need. $start = TimerInit() Sleep(1000) $stop = TimerDiff($start) MsgBox(0, "Difference is, ms", $stop) Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
dash007 Posted May 25, 2005 Author Posted May 25, 2005 What I mean is that when you look at the GUI by running the script TicktoTime in the help section you will see 00:00:00. I am wondering what can be done to have it look and function like 00:00:00:00 where the last 00 are milliseconds. This is how you would see with screenshots of most stopwatches eg Xnote stopwatch.
upnorth Posted May 25, 2005 Posted May 25, 2005 (edited) Func _TicksToTime_ms($iTicks) Local $ihms[5], $split $iTicks = $iTicks / 1000 $ihms[1] = Int($iTicks / 3600) $iTicks = Mod($iTicks, 3600) $ihms[2] = Int($iTicks / 60) $ihms[3] = Mod($iTicks, 60) $split = StringSplit( $ihms[3], ".") $ihms[4] = $split[2] Return StringFormat( "%02i:%02i:%02i:%02i", $ihms[1], $ihms[2], $ihms[3], $ihms[4]) EndFunc ;==>_TicksToTime_ms $timer = TimerInit() Sleep( 1234) MsgBox( 0, " ", _TicksToTime_ms(TimerDiff( $timer))) Thanks for StringFormat idea. Edited May 25, 2005 by UP NORTH
dash007 Posted May 25, 2005 Author Posted May 25, 2005 Ok I got the GUI to look the way I want by: GUICtrlCreateLabel("00:00:00:00", 10,10) $Time = StringFormat("%02i:%02i:%02i:%02i", $Hour, $Mins, $Secs, $Ms) But I dont know what coding I need to give $Ms so that it runs too when I launch the stopwatch. Anyone?
dash007 Posted May 25, 2005 Author Posted May 25, 2005 Thank you UPNorth, I will have a look at your suggestion tonight...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now