Home |
Function xn_sntp_get_time |
Function xn_sntp_get_timeThis function retrieves the current date and time of day from an SNTP server. typedef struct _ebs_sys_time { int year; int month; int day; int hour; int minute; int second; int msec; char day_of_week[10]; } EBS_SYS_TIME; int xn_sntp_get_time(EBS_SYS_TIME * tme, BYTE * ip_sntp_server, int version); ParameterstmePointer to a structure to receive the current date and time. ip_sntp_serverPointer to the IP address in network byte order of the server from which the date and time should be requested. versionThe SNTP version to use in the request. This parameter can be set to SNTP_VERSION_3 or SNTP_VERSION_4. Most servers will support SNTP_VERSION_3. return valueReturns 0 if successful, otherwise SOCKET_ERROR. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. This function will adjust the UTC time returned from the server by the time zone given in CFG_GMT_DIFF and the amount of time required to transmit the data from the server to the client. For most networks, accuracy should be better than 1 second. See demo program Sntpdemo for an example of using the SNTP client.
|