Jump to content

_TicksToTime problem, please help


Recommended Posts

Hello,

I am having trouble using the _TicksToTime function I can't seem to get the variables for the hours, mins, and seconds back from the function. Please help me understand what I am doing wrong. I have included the code snippet that isn't working

From AutoIt Help:

#Include <date.au3>

_TicksToTime ( $iTicks, $iHours, $iMins, $iSecs )

Parameters

$iTicks Tick amount.

$iHours Variable to store the hours.

$iMins Variable to store the minutes.

$iSecs Variable to store the seconds.

My Code:

#Include <date.au3>

Dim $begin, $diff, $hours, $mins, $seconds

$begin = TimerInit()

sleep(5000)

$diff = TimerDiff($begin)

_TicksToTime($diff,$hours,$mins,$seconds)

MsgBox(0,"Elapsed Time", $hours & "hours " & $mins & "mins " & $seconds & "secs")

Link to comment
Share on other sites

I needed to round the ticks to the nearest integer or the funciton won't work... my bad!

#Include <date.au3>

Dim $begin, $diff, $hours, $mins, $seconds

$begin = TimerInit()

sleep(5000)

$diff = TimerDiff($begin)

_TicksToTime(Round($diff,0),$hours,$mins,$seconds)

MsgBox(0,"Elapsed Time", $hours & "hours " & $mins & "mins " & $seconds & "secs")

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...