Internet Direct (Indy)
Home
PreviousUpNext
GetTickDiff Function

Calculates the elapsed tick count from two tick count values.

Pascal
function GetTickDiff(
    const AOldTickCount: Cardinal; 
    const ANewTickCount: Cardinal
): Cardinal;
Parameters 
Description 
AOldTickCount 
Time value for the comparision.
 
ANewTickCount 
Time value for the comparision. 

Cardinal - Elapsed tick count for the specified arguments.

GetTickDiff is a Cardinal function that calculates the elapsed tick count using the values in AOldTickCount and ANewTickCount. AOldTickCount and ANewTickCount are the starting and ending tick counts as returned by the Ticks function. GetTickDiff exists because a Ticks value can rollover to zero (0) when it exceeds the maximum value represented in the Cardinal data type. 

GetTickDiff handles this situation in calculating the elapsed tick count. When ANewTickCount is greater than (or equal to) AOldTickCount, the return value is calculated using: 

 

  ANewTickCount - AOldTickCount;

 

When ANewTickCount is less than AOldTickCount, the return value is adjusted and calculated using: 

 

  High(Cardinal) - AOldTickCount + ANewTickCount;

 

GetTickDiff is used when calculating the values returned in TIdEcho.EchoTime and TIdEchoUDP.EchoTime, as well as the values returned in TIdTime.RoundTripDelay and TIdTimeUDP.RoundTripDelay.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.