Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted (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 by UP NORTH
Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...