Difference between revisions of "TNTPClient"
From Ultibo.org
(Created page with "Return to Unit Services __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible mw-...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 47: | Line 47: | ||
| <code>FRetryTimeout:LongWord;</code> | | <code>FRetryTimeout:LongWord;</code> | ||
| How long to wait between poll retries (in milliseconds) | | How long to wait between poll retries (in milliseconds) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FUseClockOffset:Boolean;</code> | ||
+ | | Use the calculated NTP clock offset to update the local time | ||
+ | |- | ||
+ | | <code>FClockTolerance:LongWord;</code> | ||
+ | | Milliseconds difference between local and remote to trigger a clock set | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
Line 55: | Line 63: | ||
| <code>FInitialClockCount:LongWord;</code> | | <code>FInitialClockCount:LongWord;</code> | ||
| How many times have we tried to obtain the initial clock | | How many times have we tried to obtain the initial clock | ||
+ | |- | ||
+ | | <code>FInitialClockRetry:Boolean;</code> | ||
+ | | Should the client setup a worker thread to retry until the initial clock has been set (Default: True) | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
Line 83: | Line 94: | ||
|- | |- | ||
| <code>procedure SetRetryTimeout(ARetryTimeout:LongWord);</code> | | <code>procedure SetRetryTimeout(ARetryTimeout:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetUseClockOffset(AUseClockOffset:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetClockTolerance(AClockTolerance:LongWord);</code> | ||
| | | | ||
|- | |- | ||
Line 112: | Line 131: | ||
|- | |- | ||
| <code>property RetryTimeout:LongWord read FRetryTimeout write SetRetryTimeout;</code> | | <code>property RetryTimeout:LongWord read FRetryTimeout write SetRetryTimeout;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property UseClockOffset:Boolean read FUseClockOffset write SetUseClockOffset;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property ClockTolerance:LongWord read FClockTolerance write SetClockTolerance;</code> | ||
| | | | ||
|- | |- | ||
Line 120: | Line 147: | ||
|- | |- | ||
| <code>property InitialClockCount:LongWord read FInitialClockCount write SetInitialClockCount;</code> | | <code>property InitialClockCount:LongWord read FInitialClockCount write SetInitialClockCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property InitialClockRetry:Boolean read FInitialClockRetry write SetInitialClockRetry;</code> | ||
| | | | ||
|- | |- | ||
Line 135: | Line 165: | ||
|- | |- | ||
| <code>procedure IncrementInitialClockCount;</code> | | <code>procedure IncrementInitialClockCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function FormatTime(Time:Int64):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FormatOffset(Offset:Int64):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CalculateClockOffset(T1,T2,T3,T4:Int64):Int64;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CalculateRoundtripDelay(T1,T2,T3,T4:Int64):Int64;</code> | ||
| | | | ||
|- | |- | ||
Line 231: | Line 277: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetRetryTimeout(ARetryTimeout:LongWord);</pre> | <pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetRetryTimeout(ARetryTimeout:LongWord);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetUseClockOffset(AUseClockOffset:Boolean);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetClockTolerance(AClockTolerance:LongWord);</pre> | ||
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
Line 255: | Line 325: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetInitialClockCount(AInitialClockCount:LongWord);</pre> | <pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetInitialClockCount(AInitialClockCount:LongWord);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure TNTPClient.SetInitialClockRetry(AInitialClockRetry:Boolean);</pre> | ||
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
Line 297: | Line 379: | ||
! Note | ! Note | ||
| None documented | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function TNTPClient.FormatTime(Time:Int64):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function TNTPClient.FormatOffset(Offset:Int64):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function TNTPClient.CalculateClockOffset(T1,T2,T3,T4:Int64):Int64;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | T1 = Originate Timestamp (time request sent by client) T2 = Receive Timestamp (time request received by server) T3 = Transmit Timestamp (time reply sent by server) T4 = Destination Timestamp (time reply received by client) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function TNTPClient.CalculateRoundtripDelay(T1,T2,T3,T4:Int64):Int64;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | T1 = Originate Timestamp (time request sent by client) T2 = Receive Timestamp (time request received by server) T3 = Transmit Timestamp (time reply sent by server) T4 = Destination Timestamp (time reply received by client) | ||
|- | |- | ||
|} | |} |
Latest revision as of 06:04, 13 September 2022
Return to Unit Services
Description
To be documented
Class definitions
TNTPClient = class(TWinsock2UDPClient)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TMutexHandle;
|
|
FPollInterval:LongWord;
|
How often to poll the server (in seconds) |
FPollTimeout:LongWord;
|
How long before receive or send timeout occurs (in milliseconds) |
FPollRetries:LongWord;
|
How many times to retry a poll |
FRetryTimeout:LongWord;
|
How long to wait between poll retries (in milliseconds) |
FUseClockOffset:Boolean;
|
Use the calculated NTP clock offset to update the local time |
FClockTolerance:LongWord;
|
Milliseconds difference between local and remote to trigger a clock set |
FInitialClockGet:Boolean;
|
Has the time been obtained at least once |
FInitialClockCount:LongWord;
|
How many times have we tried to obtain the initial clock |
FInitialClockRetry:Boolean;
|
Should the client setup a worker thread to retry until the initial clock has been set (Default: True) |
FTimerHandle:TTimerHandle;
|
Handle for the NTP update timer |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
procedure SetPollInterval(APollInterval:LongWord);
|
|
procedure SetPollTimeout(APollTimeout:LongWord);
|
|
procedure SetPollRetries(APollRetries:LongWord);
|
|
procedure SetRetryTimeout(ARetryTimeout:LongWord);
|
|
procedure SetUseClockOffset(AUseClockOffset:Boolean);
|
|
procedure SetClockTolerance(AClockTolerance:LongWord);
|
|
procedure SetInitialClockGet(AInitialClockGet:Boolean);
|
|
procedure SetInitialClockCount(AInitialClockCount:LongWord);
|
|
procedure SetTimerHandle(ATimerHandle:TTimerHandle);
|
|
public
| |
property PollInterval:LongWord read FPollInterval write SetPollInterval;
|
|
property PollTimeout:LongWord read FPollTimeout write SetPollTimeout;
|
|
property PollRetries:LongWord read FPollRetries write SetPollRetries;
|
|
property RetryTimeout:LongWord read FRetryTimeout write SetRetryTimeout;
|
|
property UseClockOffset:Boolean read FUseClockOffset write SetUseClockOffset;
|
|
property ClockTolerance:LongWord read FClockTolerance write SetClockTolerance;
|
|
property InitialClockGet:Boolean read FInitialClockGet write SetInitialClockGet;
|
|
property InitialClockCount:LongWord read FInitialClockCount write SetInitialClockCount;
|
|
property InitialClockRetry:Boolean read FInitialClockRetry write SetInitialClockRetry;
|
|
property TimerHandle:TTimerHandle read FTimerHandle write SetTimerHandle;
|
|
function GetTime:Int64;
|
|
procedure IncrementInitialClockCount;
|
|
function FormatTime(Time:Int64):String;
|
|
function FormatOffset(Offset:Int64):String;
|
|
function CalculateClockOffset(T1,T2,T3,T4:Int64):Int64;
|
|
function CalculateRoundtripDelay(T1,T2,T3,T4:Int64):Int64;
|
Function declarations
constructor TNTPClient.Create;
Description: To be documented
Note | None documented |
---|
destructor TNTPClient.Destroy;
Description: To be documented
Note | None documented |
---|
function TNTPClient.AcquireLock:Boolean;
Description: To be documented
Note | None documented |
---|
function TNTPClient.ReleaseLock:Boolean;
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetPollInterval(APollInterval:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetPollTimeout(APollTimeout:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetPollRetries(APollRetries:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetRetryTimeout(ARetryTimeout:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetUseClockOffset(AUseClockOffset:Boolean);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetClockTolerance(AClockTolerance:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetInitialClockGet(AInitialClockGet:Boolean);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetInitialClockCount(AInitialClockCount:LongWord);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetInitialClockRetry(AInitialClockRetry:Boolean);
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.SetTimerHandle(ATimerHandle:TTimerHandle);
Description: To be documented
Note | None documented |
---|
function TNTPClient.GetTime:Int64;
Description: To be documented
Note | None documented |
---|
procedure TNTPClient.IncrementInitialClockCount;
Description: To be documented
Note | None documented |
---|
function TNTPClient.FormatTime(Time:Int64):String;
Description: To be documented
Note | None documented |
---|
function TNTPClient.FormatOffset(Offset:Int64):String;
Description: To be documented
Note | None documented |
---|
function TNTPClient.CalculateClockOffset(T1,T2,T3,T4:Int64):Int64;
Description: To be documented
Note | T1 = Originate Timestamp (time request sent by client) T2 = Receive Timestamp (time request received by server) T3 = Transmit Timestamp (time reply sent by server) T4 = Destination Timestamp (time reply received by client) |
---|
function TNTPClient.CalculateRoundtripDelay(T1,T2,T3,T4:Int64):Int64;
Description: To be documented
Note | T1 = Originate Timestamp (time request sent by client) T2 = Receive Timestamp (time request received by server) T3 = Transmit Timestamp (time reply sent by server) T4 = Destination Timestamp (time reply received by client) |
---|
Return to Unit Reference