/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
- * FILE: lib/kernel32/misc/time.c
+ * FILE: dll/win32/kernel32/wine/timezone.c
* PURPOSE: Time conversion functions
* PROGRAMMER: Ariadne
* DOSDATE and DOSTIME structures from Onno Hovers
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
-/* STATIC FUNTIONS **********************************************************/
+/* STATIC FUNCTIONS **********************************************************/
static inline int IsLeapYear(int Year)
{
WINAPI
GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
{
+ RTL_TIME_ZONE_INFORMATION TimeZoneInformation;
NTSTATUS Status;
DPRINT("GetTimeZoneInformation()\n");
Status = NtQuerySystemInformation(SystemCurrentTimeZoneInformation,
- lpTimeZoneInformation,
- sizeof(TIME_ZONE_INFORMATION),
+ &TimeZoneInformation,
+ sizeof(RTL_TIME_ZONE_INFORMATION),
NULL);
if (!NT_SUCCESS(Status))
{
return TIME_ZONE_ID_INVALID;
}
+ lpTimeZoneInformation->Bias = TimeZoneInformation.Bias;
+
+ wcsncpy(lpTimeZoneInformation->StandardName,
+ TimeZoneInformation.StandardName,
+ ARRAYSIZE(lpTimeZoneInformation->StandardName));
+ lpTimeZoneInformation->StandardDate.wYear = TimeZoneInformation.StandardDate.Year;
+ lpTimeZoneInformation->StandardDate.wMonth = TimeZoneInformation.StandardDate.Month;
+ lpTimeZoneInformation->StandardDate.wDay = TimeZoneInformation.StandardDate.Day;
+ lpTimeZoneInformation->StandardDate.wHour = TimeZoneInformation.StandardDate.Hour;
+ lpTimeZoneInformation->StandardDate.wMinute = TimeZoneInformation.StandardDate.Minute;
+ lpTimeZoneInformation->StandardDate.wSecond = TimeZoneInformation.StandardDate.Second;
+ lpTimeZoneInformation->StandardDate.wDayOfWeek = TimeZoneInformation.StandardDate.Weekday;
+ lpTimeZoneInformation->StandardBias = TimeZoneInformation.StandardBias;
+
+ wcsncpy(lpTimeZoneInformation->DaylightName,
+ TimeZoneInformation.DaylightName,
+ ARRAYSIZE(lpTimeZoneInformation->DaylightName));
+ lpTimeZoneInformation->DaylightDate.wYear = TimeZoneInformation.DaylightDate.Year;
+ lpTimeZoneInformation->DaylightDate.wMonth = TimeZoneInformation.DaylightDate.Month;
+ lpTimeZoneInformation->DaylightDate.wDay = TimeZoneInformation.DaylightDate.Day;
+ lpTimeZoneInformation->DaylightDate.wHour = TimeZoneInformation.DaylightDate.Hour;
+ lpTimeZoneInformation->DaylightDate.wMinute = TimeZoneInformation.DaylightDate.Minute;
+ lpTimeZoneInformation->DaylightDate.wSecond = TimeZoneInformation.DaylightDate.Second;
+ lpTimeZoneInformation->DaylightDate.wDayOfWeek = TimeZoneInformation.DaylightDate.Weekday;
+ lpTimeZoneInformation->DaylightBias = TimeZoneInformation.DaylightBias;
+
return TIME_ZoneID(lpTimeZoneInformation);
}
WINAPI
SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
{
+ RTL_TIME_ZONE_INFORMATION TimeZoneInformation;
NTSTATUS Status;
DPRINT("SetTimeZoneInformation()\n");
- Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation);
+ TimeZoneInformation.Bias = lpTimeZoneInformation->Bias;
+
+ wcsncpy(TimeZoneInformation.StandardName,
+ lpTimeZoneInformation->StandardName,
+ ARRAYSIZE(TimeZoneInformation.StandardName));
+ TimeZoneInformation.StandardDate.Year = lpTimeZoneInformation->StandardDate.wYear;
+ TimeZoneInformation.StandardDate.Month = lpTimeZoneInformation->StandardDate.wMonth;
+ TimeZoneInformation.StandardDate.Day = lpTimeZoneInformation->StandardDate.wDay;
+ TimeZoneInformation.StandardDate.Hour = lpTimeZoneInformation->StandardDate.wHour;
+ TimeZoneInformation.StandardDate.Minute = lpTimeZoneInformation->StandardDate.wMinute;
+ TimeZoneInformation.StandardDate.Second = lpTimeZoneInformation->StandardDate.wSecond;
+ TimeZoneInformation.StandardDate.Weekday = lpTimeZoneInformation->StandardDate.wDayOfWeek;
+ TimeZoneInformation.StandardBias = lpTimeZoneInformation->StandardBias;
+
+ wcsncpy(TimeZoneInformation.DaylightName,
+ lpTimeZoneInformation->DaylightName,
+ ARRAYSIZE(TimeZoneInformation.DaylightName));
+ TimeZoneInformation.DaylightDate.Year = lpTimeZoneInformation->DaylightDate.wYear;
+ TimeZoneInformation.DaylightDate.Month = lpTimeZoneInformation->DaylightDate.wMonth;
+ TimeZoneInformation.DaylightDate.Day = lpTimeZoneInformation->DaylightDate.wDay;
+ TimeZoneInformation.DaylightDate.Hour = lpTimeZoneInformation->DaylightDate.wHour;
+ TimeZoneInformation.DaylightDate.Minute = lpTimeZoneInformation->DaylightDate.wMinute;
+ TimeZoneInformation.DaylightDate.Second = lpTimeZoneInformation->DaylightDate.wSecond;
+ TimeZoneInformation.DaylightDate.Weekday = lpTimeZoneInformation->DaylightDate.wDayOfWeek;
+ TimeZoneInformation.DaylightBias = lpTimeZoneInformation->DaylightBias;
+
+ Status = RtlSetTimeZoneInformation(&TimeZoneInformation);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status);
}
Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation,
- (PVOID)lpTimeZoneInformation,
- sizeof(TIME_ZONE_INFORMATION));
+ (PVOID)&TimeZoneInformation,
+ sizeof(RTL_TIME_ZONE_INFORMATION));
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetSystemInformation() failed (Status %lx)\n", Status);