SameTime
SameTime compares two TDateTime values A and B, to test whether they represent the same time of day (hour, minute, second, and millisecond), ignoring the date portion.
SameTime returns True if the two specified values occur on the same hour, minute, second, and millisecond, and returns False if they are not the same.
It is possible to create two TDateTime values that differ numerically when viewed as floating point types, but which represent the same hour, minute, second, and millisecond.
SameTime allows applications to determine when two TDateTime values represent the same time, even when the fractional parts of the values differ.
Declaration: function SameTime(const A, B: TDateTime): Boolean;
A simple example showing a passed test and a failed test follows.
procedure ScriptEvent (var Value : variant);var DateTime1, DateTime2 : TDateTime; Counter : integer;begin //These will be the same DateTime1 := Time; DateTime2 := Time; If SameTime(DateTime1, DateTime2) then LogInfo('They are the same time!') else LogInfo('They are NOT the same time!'); Counter := 1; while Counter < 500 do begin Counter := Counter + 1; end; //These will not be the same DateTime2 := Time; If SameTime(DateTime1, DateTime2) then LogInfo('They are the same time!') else LogInfo('They are NOT the same time!'); end;