Adjusted Time Zone Bias

Submitted by:Jhon Smith

Date added:23 January, 2013

Category:Delphi

Adjusted for daylight saving or standard time as appropriate.

Tags: daylight saving

Code Snippet:

function AdjustedTimeZoneBias: Integer;
var
TZI: Windows.TTimeZoneInformation; // info about time zone
begin
Result := 0; // keeps compiler quiet
case Windows.GetTimeZoneInformation(TZI) of
Windows.TIME_ZONE_ID_INVALID: SysUtils.RaiseLastOSError;
Windows.TIME_ZONE_ID_STANDARD: Result := TZI.Bias + TZI.StandardBias;
Windows.TIME_ZONE_ID_DAYLIGHT: Result := TZI.Bias + TZI.DaylightBias;
Windows.TIME_ZONE_ID_UNKNOWN: Result := TZI.Bias;
end;
end;
 
 

Comments