21#define TICKSPERMIN 600000000
23#define LL2FILETIME( ll, pft )\
24 (pft)->dwLowDateTime = (UINT)(ll); \
25 (pft)->dwHighDateTime = (UINT)((ll) >> 32);
26#define FILETIME2LL( pft, ll) \
27 ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
31 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
32 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
39 return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
61 int limit_day, dayinsecs;
81 limit_day =
First + 7 * (weekofmonth - 1);
93 limit_day = ((limit_day * 24 +
compareDate->wHour) * 60 +
95 dayinsecs = ((
date->wDay * 24 +
date->wHour) * 60 +
96 date->wMinute ) * 60 +
date->wSecond;
98 return dayinsecs < limit_day ? -1 :
99 dayinsecs > limit_day ? 1 :
124 BOOL beforeStandardDate, afterDaylightDate;
150 lpFileTime = &ftTemp;
154 year = SysTime.
wYear;
163 if(year == SysTime.
wYear) {
168 beforeStandardDate =
ret < 0;
170 beforeStandardDate = SysTime.
wYear < year;
179 if(year == SysTime.
wYear) {
184 afterDaylightDate =
ret >= 0;
186 afterDaylightDate = SysTime.
wYear > year;
191 if( beforeStandardDate && afterDaylightDate )
194 if( beforeStandardDate || afterDaylightDate )
267 DPRINT(
"GetTimeZoneInformation()\n");
270 &TimeZoneInformation,
279 lpTimeZoneInformation->
Bias = TimeZoneInformation.
Bias;
321 DPRINT(
"SetTimeZoneInformation()\n");
323 TimeZoneInformation.
Bias = lpTimeZoneInformation->Bias;
326 lpTimeZoneInformation->StandardName,
328 TimeZoneInformation.
StandardDate.
Year = lpTimeZoneInformation->StandardDate.wYear;
329 TimeZoneInformation.
StandardDate.
Month = lpTimeZoneInformation->StandardDate.wMonth;
330 TimeZoneInformation.
StandardDate.
Day = lpTimeZoneInformation->StandardDate.wDay;
331 TimeZoneInformation.
StandardDate.
Hour = lpTimeZoneInformation->StandardDate.wHour;
332 TimeZoneInformation.
StandardDate.
Minute = lpTimeZoneInformation->StandardDate.wMinute;
333 TimeZoneInformation.
StandardDate.
Second = lpTimeZoneInformation->StandardDate.wSecond;
336 TimeZoneInformation.
StandardBias = lpTimeZoneInformation->StandardBias;
339 lpTimeZoneInformation->DaylightName,
341 TimeZoneInformation.
DaylightDate.
Year = lpTimeZoneInformation->DaylightDate.wYear;
342 TimeZoneInformation.
DaylightDate.
Month = lpTimeZoneInformation->DaylightDate.wMonth;
343 TimeZoneInformation.
DaylightDate.
Day = lpTimeZoneInformation->DaylightDate.wDay;
344 TimeZoneInformation.
DaylightDate.
Hour = lpTimeZoneInformation->DaylightDate.wHour;
345 TimeZoneInformation.
DaylightDate.
Minute = lpTimeZoneInformation->DaylightDate.wMinute;
346 TimeZoneInformation.
DaylightDate.
Second = lpTimeZoneInformation->DaylightDate.wSecond;
349 TimeZoneInformation.
DaylightBias = lpTimeZoneInformation->DaylightBias;
354 DPRINT1(
"RtlSetTimeZoneInformation() failed (Status %lx)\n",
Status);
360 (
PVOID)&TimeZoneInformation,
364 DPRINT1(
"NtSetSystemInformation() failed (Status %lx)\n",
Status);
386 if (lpTimeZoneInformation !=
NULL)
388 TzInfo = *lpTimeZoneInformation;
396 if (!lpUniversalTime || !lpLocalTime)
430 if (lpTimeZoneInformation !=
NULL)
432 tzinfo = *lpTimeZoneInformation;
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
static int TIME_DayLightCompareDate(const SYSTEMTIME *date, const SYSTEMTIME *compareDate)
BOOL WINAPI SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, CONST SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime)
#define FILETIME2LL(pft, ll)
static BOOL TIME_GetTimezoneBias(const TIME_ZONE_INFORMATION *pTZinfo, FILETIME *lpFileTime, BOOL islocal, LONG *pBias)
#define LL2FILETIME(ll, pft)
BOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
static DWORD TIME_CompTimeZoneID(const TIME_ZONE_INFORMATION *pTZinfo, FILETIME *lpFileTime, BOOL islocal)
static DWORD TIME_ZoneID(const TIME_ZONE_INFORMATION *pTzi)
static const int MonthLengths[2][12]
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
BOOL WINAPI TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
static int compareDate(const void *arg1, const void *arg2)
@ SystemCurrentTimeZoneInformation
NTSYSAPI NTSTATUS NTAPI RtlSetTimeZoneInformation(_In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
#define TIME_ZONE_ID_UNKNOWN
#define TIME_ZONE_ID_STANDARD
#define TIME_ZONE_ID_DAYLIGHT
DWORD BaseSetLastNTError(IN NTSTATUS Status)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define TIME_ZONE_ID_INVALID