Recent

Author Topic: found bug on GetLocalTimeOffset  (Read 4755 times)

herux

  • Full Member
  • ***
  • Posts: 102
found bug on GetLocalTimeOffset
« on: April 27, 2016, 09:16:15 am »
Hi all,

I think i found bug on GetLocalTimeOffset, This method is in SysUtils unit. they did not response correctly  ::) , when I access method
Code: Pascal  [Select][+][-]
  1. LocalTimeToUniversal(Now, GetLocalTimeOffset);

Here, in my country, localtime is GMT+7, so the integer value is 420, but GetLocalTimeOffset return -420

LocalTimeToUniversal code is here ..
Code: Pascal  [Select][+][-]
  1. Function LocalTimeToUniversal(LT: TDateTime;TZOffset: Integer): TDateTime;
  2.  
  3. begin
  4.   if (TZOffset > 0) then
  5.     Result := LT - EncodeTime(TZOffset div 60, TZOffset mod 60, 0, 0)
  6.   else if (TZOffset < 0) then
  7.     Result := LT + EncodeTime(Abs(TZOffset) div 60, Abs(TZOffset) mod 60, 0, 0)
  8.   else
  9.     Result := LT;
  10. end;

I tried it on Windows 8.1 and Mac OS X El-Capitan, fpc 3.0.0

herux
« Last Edit: April 27, 2016, 09:18:31 am by herux »

balazsszekely

  • Guest
Re: found bug on GetLocalTimeOffset
« Reply #1 on: April 27, 2016, 09:41:31 am »

herux

  • Full Member
  • ***
  • Posts: 102
Re: found bug on GetLocalTimeOffset
« Reply #2 on: April 28, 2016, 04:02:37 am »
bugtracker said it was resolved to FPC target version 3.0.0 , I am using it now, why is it still happening ?

balazsszekely

  • Guest
Re: found bug on GetLocalTimeOffset
« Reply #3 on: April 28, 2016, 06:19:11 am »
Then reopen the bug, attach a test project(source only) zipped, which reproduce the error.

herux

  • Full Member
  • ***
  • Posts: 102
Re: found bug on GetLocalTimeOffset
« Reply #4 on: April 28, 2016, 06:28:47 am »
Okey, I will do that, thank you @GetMem  :D

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: found bug on GetLocalTimeOffset
« Reply #5 on: May 03, 2016, 11:50:13 am »
The first bug report was marked as fixed in FPC 3.0, but it was fixed wrongly. That's what the second bug report is about, and that bug will be fixed in FPC 3.0.2

 

TinyPortal © 2005-2018