Jump to content

TimerDiff problem


Recommended Posts

I'm having a problem with TimerDiff.

The problem is: I have one script that runs and I need to mark when it gets to a certain point. Then some time later (could be milliseconds later so precision is important) a second script runs and it needs to know how long has elapsed since the first script hit its magic marking point.

What does not work (but I want to achieve and equivalent to):

Script1

...
FileWriteLine( "TempFile", TimerInit() )
...

Script2

...
$TimeElapsed=TimerDiff( FileReadLine( "TempFile" ) )
...

I tried wrapping the value retrieved from TimerInit in Binary and other conversions before writing it to the file with no success. And there's no notes on the TimerInit or TimerDiff function on how the systemclock is represented in the output/input to those functions... So, is there a way to export the value from TimerInit that is readable later? Or alternately, is there a simple way to read the system clock to find the number of milliseconds elapsed since midnight that I could just do whatever I want with?

Thanks for any help!

Mother

Link to comment
Share on other sites

The original code worked fine for me but the timediff returned was incorrect (should have been 1000, shows 2000), use an ini instead.

IniWrite ( "timestamp.ini", "lastrun", "timestamp", TimerInit())

Sleep(1000)

$TimeElapsed = TimerDiff(IniRead ( "timestamp.ini", "lastrun", "timestamp", "" ))

MsgBox(0,"",$TimeElapsed)
Link to comment
Share on other sites

Ok, another case of me being stupid...

There's these things called parenthesis that are good to use in math formulas with you want to do things like divide a difference of two numbers.

i.e. (TimerDiff( $time1 ) - TimerDiff( $time2 ) ) / 1000... those outer parenthesis are important! Sorry for the bother with a dumb problem.

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...