/*********************************************************************** * GetTimeZoneInformation (KERNEL32.@) * * Get information about the current local time zone. * * PARAMS * tzinfo [out] Destination for time zone information. * * RETURNS * TIME_ZONE_ID_INVALID An error occurred * TIME_ZONE_ID_UNKNOWN There are no transition time known * TIME_ZONE_ID_STANDARD Current time is standard time * TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time */ DWORD WINAPI GetTimeZoneInformation( LPTIME_ZONE_INFORMATION tzinfo ) { NTSTATUS status; status = RtlQueryTimeZoneInformation( (RTL_TIME_ZONE_INFORMATION*)tzinfo ); if ( status != STATUS_SUCCESS ) { SetLastError( RtlNtStatusToDosError(status) ); return TIME_ZONE_ID_INVALID; } return TIME_ZoneID( tzinfo ); }
BOOLEAN NTAPI ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime) { LARGE_INTEGER CurrentTime; NTSTATUS Status; /* Read time zone information from the registry */ Status = RtlQueryTimeZoneInformation(&ExpTimeZoneInfo); if (!NT_SUCCESS(Status)) { /* Failed, clear all data */ RtlZeroMemory(&ExpTimeZoneInfo, sizeof(TIME_ZONE_INFORMATION)); ExpTimeZoneBias.QuadPart = (LONGLONG)0; ExpTimeZoneId = TIME_ZONE_ID_UNKNOWN; } else { /* FIXME: Calculate transition dates */ /* Set bias and ID */ ExpTimeZoneBias.QuadPart = ((LONGLONG)(ExpTimeZoneInfo.Bias + ExpTimeZoneInfo.StandardBias)) * TICKSPERMINUTE; ExpTimeZoneId = TIME_ZONE_ID_STANDARD; } /* Change it for user-mode applications */ SharedUserData->TimeZoneBias.High1Time = ExpTimeZoneBias.u.HighPart; SharedUserData->TimeZoneBias.High2Time = ExpTimeZoneBias.u.HighPart; SharedUserData->TimeZoneBias.LowPart = ExpTimeZoneBias.u.LowPart; SharedUserData->TimeZoneId = ExpTimeZoneId; /* Convert boot time from local time to UTC */ KeBootTime.QuadPart += ExpTimeZoneBias.QuadPart; /* Convert system time from local time to UTC */ do { CurrentTime.u.HighPart = SharedUserData->SystemTime.High1Time; CurrentTime.u.LowPart = SharedUserData->SystemTime.LowPart; } while (CurrentTime.u.HighPart != SharedUserData->SystemTime.High2Time); /* Change it for user-mode applications */ CurrentTime.QuadPart += ExpTimeZoneBias.QuadPart; SharedUserData->SystemTime.LowPart = CurrentTime.u.LowPart; SharedUserData->SystemTime.High1Time = CurrentTime.u.HighPart; SharedUserData->SystemTime.High2Time = CurrentTime.u.HighPart; /* Return success */ return TRUE; }