johnhusk24 0 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 Share this post Link to post Share on other sites
Andreik 66 Posted March 23, 2011 Have a look in help file at function _DateDiff() When the words fail... music speaks Share this post Link to post Share on other sites
johnhusk24 0 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() Share this post Link to post Share on other sites
johnhusk24 0 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 ) Share this post Link to post Share on other sites