Skip to content

LocalTimeToUniversal returns wrong value

Original Reporter info from Mantis: mjustin
  • Reporter name:

Description:

My local time zone is UTC+1, so when it is 16:30 here, this line

ShowMessage(DateTimeToStr(LocalTimeToUniversal(Now)));

displays the correct value "12.12.2015 15:30" with Lazarus 1.4.2 / Free Pascal 2.6.4.

With Free Pascal 3.0.0 (Lazarus 1.6RC1) it displays "12.12.2015 17:30", two hours later.

Steps to reproduce:

in a GUI application use ShowMessage(DateTimeToStr(LocalTimeToUniversal(Now))); to display the current UTC time

Additional information:

Related: http://mantis.freepascal.org/view.php?id=24752 (marked as resolved in 3.0.0)

Mantis conversion info:

  • Mantis ID: 29176
  • Platform: Windows
  • Version: 3.0.0
  • Fixed in version: 3.1.1
  • Target version: 3.0.2
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information