# Timer Question - RESOLVED

## Recommended Posts

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

##### Share on other sites

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.

Edited by czardas

## Create an account

Register a new account