rancohen
7 years agoOccasional Contributor
compare two variables between values
Hi,
I have textbox that show time with seconds.
I need to verify number of seconds pass from last reading, since the test take also time I have mistaken of +/-1 second in the test and that's OK.
How can I run test that will take account the accuracy of the test with +/-1 second?
I used one variable to store the previous time, and I variable that store the new time. how can I add checkpoint for time difference with +/- 1 second?
meaning, only if time difference is more or equal to 2 second, error should be record.
Thanks,
Ran
depending on your language
you can use something like... (this is sudo code)
first if values are in string format convert to time..
now_time = String_todatetime("String_now_Time");
old_time = String_toDatetime("String_old_Time")if your languge is VBScript may look like this
then compare .............
if ((now_time - old_time)=>2) { Log.Error("got more than 2 secs"); }