[fpc-devel] FPC V3.0.0 LocalTimeToUniversal() error
Michael Van Canneyt
michael at freepascal.org
Tue Jun 28 09:18:34 CEST 2016
On Tue, 28 Jun 2016, Russ Davies wrote:
> Hi,
>
> My local time zone is GMT +2, and have noticed that with V3.0.0, that the
> LocalTimeToUniversal() function is adding the offset instead of subtracting
> it:
>
> uses sysutils, dateutils;
> var
> LocalTime: TDateTime;
> begin
> LocalTime := Now();
> writeln('Offset :', GetLocalTimeOffset());
> writeln('Local Time :', TimeToStr(LocalTime));
> writeln('UTC :', TimeToStr(LocalTimeToUniversal(LocalTime)));
> end.
>
> Under 2.6.4 produces:
>
> Offset : -120
> Local Time : 05:29:13
> UTC : 03:29:13
>
> With 3.0.0:
>
> Offset :-120
> Local Time :05:31:16
> UTC :07:31:16
>
> Comparing dateutil.inc for both versions, in functions UniversalTimeToLocal()
> and LocalTimeToUniversal() the signs of the offsets have been changed
Correct. This was in response to some bugreports.
IMO the offset should be 120, not -120.
Michael.
More information about the fpc-devel
mailing list