CNetworkTime::ConvertTime Method  
 
BOOL ConvertTime(
  DWORD dwNetworkTime,  
  LPLONG lpnUnixTime  
);
BOOL ConvertTime(
  DWORD dwNetworkTime,  
  CTime& localTime  
);
BOOL ConvertTime(
  DWORD dwNetworkTime,  
  LPSYSTEMTIME lpSystemTime,  
  BOOL bLocalTime  
);
BOOL ConvertTime(
  LPSYSTEMTIME lpSystemTime,  
  LPDWORD lpdwNetworkTime  
);

The ConvertTime method converts between a 32-bit network time value and a SYSTEMTIME structure.

Parameters

dwNetworkTime
The network time to be converted.
lpnUnixTime
A pointer to a long integer which will contain the time in UNIX format. The value is the number of seconds since 1 January 1970 UTC and is commonly used with the standard C library time functions.
localTime
A CTime object which will contain the local time when the method returns.
lpSystemTime
A pointer to a SYSTEMTIME structure which will be modified for the specified network time.
bLocalTime
A boolean flag that is used to specify if the network time should be adjusted for the local timezone.

Return Value

If the network time could be converted, the method returns a non-zero value. If the network time cannot be converted, or the pointer to the SYSTEMTIME structure is invalid, the method will return zero.

Remarks

The network time value is a 32-bit number, represented as the number of seconds since midnight, 1 January 1900 UTC. It can represent a date and time up to the year 2036.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cstimv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

GetTime, SetTime