1 #ifndef _W32TIME_H 2 #define _W32TIME_H 3 4 #include <stdarg.h> 5 6 #define _INC_WINDOWS 7 #define COM_NO_WINDOWS_H 8 #define WIN32_NO_STATUS 9 10 #include <windef.h> 11 #include <winbase.h> 12 #include <winnls.h> 13 #include <winreg.h> 14 #include <winsvc.h> 15 #include <winuser.h> 16 17 #define MAX_VALUE_NAME 16383 18 #define NTPPORT 123 19 #define W32TIME_POLL_INTERVAL (4 * 60 * 60) // 4 hours. 20 21 22 /* ntpclient.c */ 23 // NTP timestamp 24 typedef struct _TIMEPACKET 25 { 26 DWORD dwInteger; 27 DWORD dwFractional; 28 } TIMEPACKET, *PTIMEPACKET; 29 30 // NTP packet 31 typedef struct _NTPPACKET 32 { 33 BYTE LiVnMode; 34 BYTE Stratum; 35 char Poll; 36 char Precision; 37 long RootDelay; 38 long RootDispersion; 39 char ReferenceID[4]; 40 TIMEPACKET ReferenceTimestamp; 41 TIMEPACKET OriginateTimestamp; 42 TIMEPACKET ReceiveTimestamp; 43 TIMEPACKET TransmitTimestamp; 44 }NTPPACKET, *PNTPPACKET; 45 46 ULONG GetServerTime(LPWSTR lpAddress); 47 48 #endif /* _W32TIME_H */ 49