Asked
— Edited
Im struggling with using time in ezscript. I want to check how long it has been since a given face was recognized. But all the time functions seem to give strings and I cant really figure out how to convert those to number and compare. Using the script help I came up this this:
Quote:
$lastfacedetection= now() ....if ( FmtTimeSpan(CDateTime(now()) - CDateTime($lastfacedetection) ), "mm") >5)) do something endif
but that doesnt work, it tells me: Operator '-' invalid for strings.
Help?
I added 2 new functions: DateTimeTicks(), DateTimeTicksToMilliseconds()
The difference is more significant for short/frequent periods.
the difference was more significant a few years ago, although the differences are relative e.g. hardware, operating system, application code optimization.
if I read your code correctly, it amplifies the difference a 100 fold, so the actual/average discrepancy is on the order of 0.5ms and much if not all of that could be caused by the execution of the code itself. If the code executed instantly (aside from a perfectly timed sleep), shouldnt you be seeing ~1000ms rather then the ~1380-1440ms you get?
FWIW, this is what I get:
@vertigo: The values are relative.
I can't get less than 50 ms difference, worst case 70 ms.
The script execution: 100 times x 10 ms + script interpretation, overhead etc etc takes between 1300 - 1800 ms.
Well thats my point; looping through the code that is doing the measuring takes almost as long to execute as the time intervals you are trying to measure. So its difficult to conclude where the difference comes from.
Either way, I think we can agree its not an atomic clock, but I also find it difficult to come up with EZB scenarios where a sub millisecond errors per measurement is a big problem.