Sign in to follow this  
Followers 0
Kasteel

Timer Question - RESOLVED

4 posts in this topic

#1 ·  Posted (edited)

Hi

This is going to be a stupid question but I hope someone can help.

I have a timer in my script which logs the time in seconds it took for the script to complete. In the middle of my script i use a sleep command of 5 seconds. I would like to subtract the 5 seconds from the total time before I write the final results. Any ideas would be appreciated.

Here is my existing code:

$timer=TimerInit()

I DO SOME STUFF HERE
sleep(5000)  <------   I want to subtract this 5 seconds from the timer before I wright the results to the text file


$handle = Fileopen("c:\logs\times.txt",1)         ; Open the target file
FileWriteline($handle,Round(TimerDiff($timer)/1000,1))              ; Append text to the target file
FileClose($handle)                     ; Close target file
Edited by Kasteel

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

I often get it wrong, so I needed to check it. Just added an alternative to the above post. I miscounted the brackets, but it's now correct. :blink:

Edited by czardas

Share this post


Link to post
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
Sign in to follow this  
Followers 0