mirror of
https://github.com/reactos/reactos.git
synced 2024-09-27 21:16:34 +00:00
[NTOS:EX] Use RtlCutoverTimeToSystemTime to determine the current time zone id
CORE-14658
This commit is contained in:
parent
97a23a5f3d
commit
c449929fef
|
@ -225,6 +225,8 @@ BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
|
ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
|
||||||
{
|
{
|
||||||
|
LARGE_INTEGER StandardTime;
|
||||||
|
LARGE_INTEGER DaylightTime;
|
||||||
LARGE_INTEGER CurrentTime;
|
LARGE_INTEGER CurrentTime;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -232,20 +234,73 @@ ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
|
||||||
Status = RtlQueryTimeZoneInformation(&ExpTimeZoneInfo);
|
Status = RtlQueryTimeZoneInformation(&ExpTimeZoneInfo);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, clear all data */
|
DPRINT1("RtlQueryTimeZoneInformation() failed (Status 0x%08lx)\n", Status);
|
||||||
RtlZeroMemory(&ExpTimeZoneInfo, sizeof(RTL_TIME_ZONE_INFORMATION));
|
return FALSE;
|
||||||
ExpTimeZoneBias.QuadPart = (LONGLONG)0;
|
}
|
||||||
ExpTimeZoneId = TIME_ZONE_ID_UNKNOWN;
|
|
||||||
|
/* Get the default bias */
|
||||||
|
ExpTimeZoneBias.QuadPart = (LONGLONG)ExpTimeZoneInfo.Bias * TICKSPERMINUTE;
|
||||||
|
|
||||||
|
if (ExpTimeZoneInfo.StandardDate.Month != 0 &&
|
||||||
|
ExpTimeZoneInfo.DaylightDate.Month != 0)
|
||||||
|
{
|
||||||
|
/* Get this years standard start time */
|
||||||
|
if (!RtlCutoverTimeToSystemTime(&ExpTimeZoneInfo.StandardDate,
|
||||||
|
&StandardTime,
|
||||||
|
CurrentBootTime,
|
||||||
|
TRUE))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCutoverTimeToSystemTime() for StandardDate failed!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get this years daylight start time */
|
||||||
|
if (!RtlCutoverTimeToSystemTime(&ExpTimeZoneInfo.DaylightDate,
|
||||||
|
&DaylightTime,
|
||||||
|
CurrentBootTime,
|
||||||
|
TRUE))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCutoverTimeToSystemTime() for DaylightDate failed!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine the time zone id and update the time zone bias */
|
||||||
|
if (DaylightTime.QuadPart < StandardTime.QuadPart)
|
||||||
|
{
|
||||||
|
if ((CurrentBootTime->QuadPart >= DaylightTime.QuadPart) &&
|
||||||
|
(CurrentBootTime->QuadPart < StandardTime.QuadPart))
|
||||||
|
{
|
||||||
|
DPRINT("Daylight time!\n");
|
||||||
|
ExpTimeZoneId = TIME_ZONE_ID_DAYLIGHT;
|
||||||
|
ExpTimeZoneBias.QuadPart += (LONGLONG)ExpTimeZoneInfo.DaylightBias * TICKSPERMINUTE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME: Calculate transition dates */
|
DPRINT("Standard time!\n");
|
||||||
|
|
||||||
/* Set bias and ID */
|
|
||||||
ExpTimeZoneBias.QuadPart = ((LONGLONG)(ExpTimeZoneInfo.Bias +
|
|
||||||
ExpTimeZoneInfo.StandardBias)) *
|
|
||||||
TICKSPERMINUTE;
|
|
||||||
ExpTimeZoneId = TIME_ZONE_ID_STANDARD;
|
ExpTimeZoneId = TIME_ZONE_ID_STANDARD;
|
||||||
|
ExpTimeZoneBias.QuadPart += (LONGLONG)ExpTimeZoneInfo.StandardBias * TICKSPERMINUTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((CurrentBootTime->QuadPart >= StandardTime.QuadPart) &&
|
||||||
|
(CurrentBootTime->QuadPart < DaylightTime.QuadPart))
|
||||||
|
{
|
||||||
|
DPRINT("Standard time!\n");
|
||||||
|
ExpTimeZoneId = TIME_ZONE_ID_STANDARD;
|
||||||
|
ExpTimeZoneBias.QuadPart += (LONGLONG)ExpTimeZoneInfo.StandardBias * TICKSPERMINUTE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("Daylight time!\n");
|
||||||
|
ExpTimeZoneId = TIME_ZONE_ID_DAYLIGHT;
|
||||||
|
ExpTimeZoneBias.QuadPart += (LONGLONG)ExpTimeZoneInfo.DaylightBias * TICKSPERMINUTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExpTimeZoneId = TIME_ZONE_ID_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change it for user-mode applications */
|
/* Change it for user-mode applications */
|
||||||
|
|
|
@ -4533,6 +4533,15 @@ RtlIpv6StringToAddressExW(
|
||||||
//
|
//
|
||||||
// Time Functions
|
// Time Functions
|
||||||
//
|
//
|
||||||
|
NTSYSAPI
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
RtlCutoverTimeToSystemTime(
|
||||||
|
_In_ PTIME_FIELDS CutoverTimeFields,
|
||||||
|
_Out_ PLARGE_INTEGER SystemTime,
|
||||||
|
_In_ PLARGE_INTEGER CurrentTime,
|
||||||
|
_In_ BOOLEAN ThisYearsCutoverOnly);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
Loading…
Reference in a new issue