Kasteel Posted July 19, 2010 Posted July 19, 2010 (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 July 19, 2010 by Kasteel
czardas Posted July 19, 2010 Posted July 19, 2010 (edited) Does this do it for you?FileWriteline($handle,Round((TimerDiff($timer)- 5000)/1000,1))ORFileWriteline($handle,Round(TimerDiff($timer)/1000 -5,1)) Edited July 19, 2010 by czardas operator64 ArrayWorkshop
Kasteel Posted July 19, 2010 Author Posted July 19, 2010 Does this do it for you? FileWriteline($handle,Round((TimerDiff($timer)- 5000)/1000,1) Thanks for your help
czardas Posted July 19, 2010 Posted July 19, 2010 (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. Edited July 19, 2010 by czardas operator64 ArrayWorkshop
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now