johnhusk24 Posted March 23, 2011 Share Posted March 23, 2011 Hello everyone,Please can some one give me some advice. I have two log files that are both changing depending on the test that is being run. I have used timestamp to mark the file test sequence. The files are log1 and log2, both have a timestamp written hh:mm:ss at each line in the file. So far I have read the last line in the file since it is updating during testing and I have two text strings that I am stripping out the time string using string handling expressions and the text strings are stored in $time1 and $time2.What I want to do is subtract the two times as a numeric operation and test the difference to make sure the times are within a tolerance of a maximum difference of 5 mins.Can anyone point me at the right command to do this or offer any useful pointers to a autoit newbie please.many thanks in advance Link to comment Share on other sites More sharing options...
Andreik Posted March 23, 2011 Share Posted March 23, 2011 Have a look in help file at function _DateDiff() When the words fail... music speaks. Link to comment Share on other sites More sharing options...
johnhusk24 Posted March 23, 2011 Author Share Posted March 23, 2011 Thank you Andreik can I ask for a few more pointers or advice.So taking my two time strings hh:mm:ss for $Time1 and $Time2 do I need to add on year, month and date with / and space before I can compare the time strings ?eg. $iDateCalc = _DateDiff( 'n',@YEAR & "/" & @MONTH & "/" & @DAY & " " & $Time1,_NowCalc())Have a look in help file at function _DateDiff() Link to comment Share on other sites More sharing options...
johnhusk24 Posted March 24, 2011 Author Share Posted March 24, 2011 Thank you Andreik can I ask for a few more pointers or advice.So taking my two time strings hh:mm:ss for $Time1 and $Time2 do I need to add on year, month and date with / and space before I can compare the time strings ?eg. $iDateCalc = _DateDiff( 'n',@YEAR & "/" & @MONTH & "/" & @DAY & " " & $Time1,_NowCalc())Thanks Andreik,I got this working and I can develop my script further good advice.Here is my test script after yoour advice#include <Date.au3>$sTime1 = _NowCalc()MsgBox( 4096, "", "Time Now: " & $sTime1 )Sleep(5000)$sTime2 = (@YEAR & "/" & @MON & "/" & @MDAY & " " & _NowTime() )MsgBox( 4096, "", "Time Next: " & $sTime2 ); Calculated the number of seconds difference$iDateCalc = _DateDiff( 's',$sTime1,$sTime2 )MsgBox( 4096, "", "Time Difference: " & $iDateCalc ) Link to comment Share on other sites More sharing options...
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