Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-07

UniversalTimeToLocal(UT: TDateTime) / LocalTimeToUniversal(LT: TDateTime)

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Ham

Hello FreePascal developers,

I believe that since SVN commit 30628 UniversalTimeToLocal(UT: TDateTime) and LocalTimeToUniversal(LT: TDateTime) are reporting incorrect values.

The multiple parameter versions of these functions had their offset handling changed to a more expected format as described in bug id 24752 [1].

The single parameter versions call GetLocalTimeOffset, which ultimately calls GetTimeZoneInformation. This function returns the 'bias', where: UTC = local time + bias [2].

The bias needs to be inverted before being sent to the new UniversalTimeToLocal/LocalTimeToUniversal functions.

Please consider the attached patch.

Thank you.

[1] http://mantis.freepascal.org/view.php?id=24752 [2]
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724421(v=vs.85).aspx

Reply by email