[fpc-devel] FPC V3.0.0 LocalTimeToUniversal() error

Russ Davies russeld.lists at gmail.com
Tue Jun 28 05:55:31 CEST 2016


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

Thanks
Russell





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160628/340fdb0b/attachment.html>


More information about the fpc-devel mailing list