ReadNetworkTime Function  
 
DWORD WINAPI ReadNetworkTime(
  HCLIENT hClient  
);

The ReadNetworkTime function returns a 32-bit network time value sent from the server.

Parameters

hClient
The client handle.

Return Value

If the function succeeds, it returns the number of seconds since midnight, 1 January 1900 UTC. If the function was unable to read the time from the specified host, it returns zero.

Remarks

The ReadNetworkTime function reads 32-bit the time value returned by the server using the handle returned by the QueryNetworkTime function. This function is included for backwards compatibility and should not be used with new applications. The 32-bit network time value can only represent a date and time up to the year 2036. Use the ReadNetworkTime64 function which returns a 64-bit integer and avoids potential problems with the 32-bit value rolling over. To obtain the time from a server synchronously, use the GetNetworkTime64 function instead.

It is important to note that the network time value is not the same as the UNIX time value used with the standard C runtime library. The time() function returns the number of seconds since January 1, 1970 which is commonly referred to as the UNIX epoch. NTP servers return the time as the number of seconds since January 1, 1900.

To convert the 32-bit time value to a SYSTEMTIME structure, use the ConvertNetworkTime function.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cstimv12.lib

See Also