WithinPastSeconds indicates True if two TDateTime values are within the specified ASeconds number of seconds of each other.
WithinPastSeconds is used to determine whether the date specified by ANow is within ASeconds seconds of the date specified by AThen.
Fractional seconds (milliseconds) do not count, so if ANow and AThen are two and a half seconds apart, calling WithinPastSeconds with ASeconds set to 2, returns True.
Declaration: function WithinPastSeconds(const ANow, AThen: TDateTime; const ASeconds: Int64): Boolean;
A simple example follows.
procedure OnMapEvent(var Value:Variant);
var
TheDate, ThatDate : TDateTime;
begin
//The IF is True as less than or equal to 2 seconds