MilliSecondsBetween returns the number of milliseconds between two specified TDateTime values.
The ordering of the two dates doesn't matter - the number of seconds will not be negative.
Declaration: Function MilliSecondsBetween(const ANow, AThen: TDateTime): Int64;
A simple example follows.