Jump to content

Can We Do Aritmetic With the Result of TimerInit()


Recommended Posts

TimerInit() returns the number of milliseconds from last system boot. TimerDiff() does the same but substracts the previous amount. Voila! A reliable metric to measure time difference. I don't see why this would change.

Heres an example:

$milliseconds = TimerDiff(0)
$years = Int($milliseconds / 31536000000)
$remainMS = Mod($milliseconds, 31536000000)
$days = Int($remainMS / 86400000)
$remainMS = Mod($milliseconds, 86400000)
$hours = Int($remainMS / 3600000)
$remainMS = Mod($milliseconds, 3600000)
$minutes = Int($remainMS / 60000)
$remainMS = Mod($milliseconds, 60000)
$seconds = Int($remainMS / 1000)
$remainMS = Mod($milliseconds, 1000)

MsgBox(0,"Time since last boot","Years: " & $years & @CRLF & "Days: " & $days & @CRLF & "Hours: " & $hours & @CRLF & "Minutes: " & $minutes & @CRLF & "Seconds: " & $seconds & @CRLF & "Milliseconds: " & Int($remainMS))
Edited by weaponx
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...