2018-06-03 14:28:57 +00:00
|
|
|
#ifndef _W32TIME_H
|
|
|
|
#define _W32TIME_H
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winnls.h>
|
|
|
|
#include <winreg.h>
|
2019-07-07 08:59:11 +00:00
|
|
|
#include <winsvc.h>
|
2021-12-06 22:24:51 +00:00
|
|
|
#include <winuser.h>
|
2018-06-03 14:28:57 +00:00
|
|
|
|
2019-07-07 08:59:11 +00:00
|
|
|
#define MAX_VALUE_NAME 16383
|
2018-06-03 14:28:57 +00:00
|
|
|
#define NTPPORT 123
|
2024-05-13 20:01:25 +00:00
|
|
|
#define W32TIME_POLL_INTERVAL (4 * 60 * 60) // 4 hours.
|
2018-06-03 14:28:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ntpclient.c */
|
|
|
|
// NTP timestamp
|
|
|
|
typedef struct _TIMEPACKET
|
|
|
|
{
|
|
|
|
DWORD dwInteger;
|
|
|
|
DWORD dwFractional;
|
|
|
|
} TIMEPACKET, *PTIMEPACKET;
|
|
|
|
|
|
|
|
// NTP packet
|
|
|
|
typedef struct _NTPPACKET
|
|
|
|
{
|
|
|
|
BYTE LiVnMode;
|
|
|
|
BYTE Stratum;
|
|
|
|
char Poll;
|
|
|
|
char Precision;
|
|
|
|
long RootDelay;
|
|
|
|
long RootDispersion;
|
|
|
|
char ReferenceID[4];
|
|
|
|
TIMEPACKET ReferenceTimestamp;
|
|
|
|
TIMEPACKET OriginateTimestamp;
|
|
|
|
TIMEPACKET ReceiveTimestamp;
|
|
|
|
TIMEPACKET TransmitTimestamp;
|
|
|
|
}NTPPACKET, *PNTPPACKET;
|
|
|
|
|
|
|
|
ULONG GetServerTime(LPWSTR lpAddress);
|
|
|
|
|
|
|
|
#endif /* _W32TIME_H */
|