diff options
author | ondrej <ondrej@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-11-03 18:15:16 +0000 |
---|---|---|
committer | ondrej <ondrej@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-11-03 18:15:16 +0000 |
commit | e5779aea9a72b3ddc8ef24e341c19242cefe45bd (patch) | |
tree | 5e35f7e7e851df29f16faaba4af83eddb67205f0 /rtl/win | |
parent | 74317ff774c2668a1086de4ee3bc3e94f0b0d95f (diff) | |
download | fpc-e5779aea9a72b3ddc8ef24e341c19242cefe45bd.tar.gz |
GetLocalTimeOffset: add InputIsUTC parameter to DateTime-aware overloads
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47293 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/win')
-rw-r--r-- | rtl/win/sysutils.pp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp index 27c159826d..c68aac4ff4 100644 --- a/rtl/win/sysutils.pp +++ b/rtl/win/sysutils.pp @@ -832,7 +832,7 @@ begin end; -function GetLocalTimeOffset(const DateTime: TDateTime; out Offset: Integer): Boolean; +function GetLocalTimeOffset(const DateTime: TDateTime; const InputIsUTC: Boolean; out Offset: Integer): Boolean; var Year: Integer; const @@ -884,8 +884,14 @@ begin if (TZInfo.StandardDate.Month>0) and (TZInfo.DaylightDate.Month>0) then begin // there is DST + // DaylightDate and StandardDate are local times DSTStart := RelWeekDayToDateTime(TZInfo.DaylightDate); DSTEnd := RelWeekDayToDateTime(TZInfo.StandardDate); + if InputIsUTC then + begin + DSTStart := DSTStart + (TZInfo.Bias+TZInfo.StandardBias)/MinsPerDay; + DSTEnd := DSTEnd + (TZInfo.Bias+TZInfo.DaylightBias)/MinsPerDay; + end; if (DateTime>DSTStart) and (DateTime<DSTEnd) then Offset := TZInfo.Bias+TZInfo.DaylightBias else |