Internet Direct (Indy)
Home
PreviousUpNext
TIdUnixTime Class

Implements a TCP-based UnixTime Protocol client.

Pascal
TIdUnixTime = class(TIdCustomTime);

TIdUnixTime is a TIdCustomTime descendant that implements a TCP/IP-based UnixTime Protocol (utime) client. 

The UnixTime Protocol counts "epochs" or seconds since the Year 1970. UnixTime recently hit it's billionth birthday. Because Unix is widely used in many environments, UnixTime was developed into a loose simple time protocol in the late 80's and early 90's. No formal UnixTime protocol has ever been officially published as an internet protocol until now. 

UnixTime operates on the well-known port number 519. Once a connection is requested on this port, exactly like in Time Protocol, the UnixTime value is sent back to the client using either the TCP/IP or UDP/IP transport. When UDP/IP is used, a small packet of data must be received by the server in order to respond in the exact same fashion as Time Protocol. The UnixTime value is then sent as an unsigned "unformatted" integer on the same port. 

The UnixTime value consists of the integer returned by the utime() function as described in <utime.h> on Unix implementations. 

TIdUnixTime uses the common methods and properties implemented in TIdCustomTime to access a remote time server, and to perform UnixTime Protocol exchanges on Port 519. 

During initialization of the component, the value for the Port property is set to 519 as expected in the utime protocol. The BaseDate member variable in the time client is set to the value specified in the constant UnixStartDate. 

Use SyncTime to synchronize the clock on the local computer with the Time Server specified in Host

Use DateTimeCard to read the UnixTime value as a Cardinal data type. Please not that the UnixTime value is the number of seconds since the base date established in the internal BaseDate member variable. 

Use DateTime to read the UnixTime value as a native TDateTime data type.

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.