16#define TICKSPERMIN 600000000
17#define TICKSPERSEC 10000000
18#define TICKSPERMSEC 10000
19#define SECSPERDAY 86400
20#define SECSPERHOUR 3600
27#define DAYSPERNORMALYEAR 365
28#define DAYSPERLEAPYEAR 366
32#define TICKSTO1970 0x019db1ded53e8000LL
33#define TICKSTO1980 0x01a8e79fe1d58000LL
35#define TICKSTO1970 0x019db1ded53e8000i64
36#define TICKSTO1980 0x01a8e79fe1d58000i64
46 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
47 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
52 return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
84 if (CutoverTimeFields->Year != 0)
89 if (SystemTime->QuadPart < CurrentTime->QuadPart)
100 if (CutoverTimeFields->Day == 0 || CutoverTimeFields->Day > 5)
108 AdjustedTimeFields.
Year = CurrentTimeFields.
Year;
109 if (NextYearsCutover)
110 AdjustedTimeFields.
Year++;
112 AdjustedTimeFields.
Month = CutoverTimeFields->Month;
113 AdjustedTimeFields.
Day = 1;
114 AdjustedTimeFields.
Hour = CutoverTimeFields->Hour;
115 AdjustedTimeFields.
Minute = CutoverTimeFields->Minute;
116 AdjustedTimeFields.
Second = CutoverTimeFields->Second;
117 AdjustedTimeFields.
Milliseconds = CutoverTimeFields->Milliseconds;
125 if (CutoverSystemTimeFields.
Weekday != CutoverTimeFields->Weekday)
127 if (CutoverSystemTimeFields.
Weekday < CutoverTimeFields->Weekday)
128 Days = CutoverTimeFields->Weekday - CutoverSystemTimeFields.
Weekday;
132 AdjustedTimeFields.
Day += Days;
136 if (CutoverTimeFields->Day > 1)
140 if ((AdjustedTimeFields.
Day + Days) > MonthLength)
143 AdjustedTimeFields.
Day += Days;
149 if (ThisYearsCutoverOnly ||
151 CutoverSystemTime.
QuadPart >= CurrentTime->QuadPart)
156 NextYearsCutover =
TRUE;
159 SystemTime->QuadPart = CutoverSystemTime.
QuadPart;
195 for (CurMonth = 1; CurMonth < IntTimeFields.
Month; CurMonth++)
220 ULONG SecondsInMinute;
257 ULONG SecondsInDay, CurYear;
298 for (CurMonth = 0; Days >= Months[CurMonth]; CurMonth++)
300 Days = Days - Months[CurMonth];
320 if (IntTime.
u.HighPart != 0)
323 *SecondsSince1970 = IntTime.
u.LowPart;
342 if (IntTime.
u.HighPart != 0)
345 *SecondsSince1980 = IntTime.
u.LowPart;
364 sizeof(TimeInformation),
369 SystemTime->QuadPart = LocalTime->QuadPart +
389 sizeof(TimeInformation),
394 LocalTime->QuadPart = SystemTime->QuadPart -
#define NT_SUCCESS(StatCode)
static WORD LeapYear(IN WORD Year)
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
@ SystemTimeOfDayInformation
static PLARGE_INTEGER Time
static const int MonthLengths[2][12]
static PTIME_FIELDS TimeFields
_Out_ PULONG ElapsedSeconds
NTSYSAPI BOOLEAN NTAPI RtlCutoverTimeToSystemTime(_In_ PTIME_FIELDS CutoverTimeFields, _Out_ PLARGE_INTEGER SystemTime, _In_ PLARGE_INTEGER CurrentTime, _In_ BOOLEAN ThisYearsCutoverOnly)
NTSTATUS NTAPI RtlLocalTimeToSystemTime(IN PLARGE_INTEGER LocalTime, OUT PLARGE_INTEGER SystemTime)
VOID NTAPI RtlSecondsSince1980ToTime(IN ULONG SecondsSince1980, OUT PLARGE_INTEGER Time)
VOID NTAPI RtlSecondsSince1970ToTime(IN ULONG SecondsSince1970, OUT PLARGE_INTEGER Time)
static const unsigned int YearLengths[2]
VOID NTAPI RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time, OUT PTIME_FIELDS TimeFields)
static int DaysSinceEpoch(int Year)
BOOLEAN NTAPI RtlTimeToSecondsSince1970(IN PLARGE_INTEGER Time, OUT PULONG SecondsSince1970)
NTSTATUS NTAPI RtlSystemTimeToLocalTime(IN PLARGE_INTEGER SystemTime, OUT PLARGE_INTEGER LocalTime)
#define DAYSPERNORMALYEAR
BOOLEAN NTAPI RtlTimeToSecondsSince1980(IN PLARGE_INTEGER Time, OUT PULONG SecondsSince1980)
#define RtlCopyMemory(Destination, Source, Length)
struct _LARGE_INTEGER::@2299 u