Due to a FPC RTL bug, the Now(), Time() and possibly Date() functions return an incorrect time unless you're actually in GMT.
A possible fix:
var
TZOffsetFromGMT : Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
TZOffsetFromGMT := NSTimeZone.localTimeZone.secondsFromGMT;
end;
use it later as follows:
var
Hour, Min, Sec, MSec : Word;
CurrTime : TDateTime;
begin
CurrTime := Now+TZOffsetFromGMT/3600.0/24.0;
DecodeTime(CurrTime,Hour,Min,Sec,MSec);
...
end;
Just to be clear... this is the fault of the FPC RTL, and *NOT* the official Delphi RTL.
ReplyDeleteYes! I figured that. I'll edit the post in a bit.
ReplyDeleteThanks Allen!
Where do I find the source for your Monday session?
ReplyDeleteRegards,
Jim
Probably next week.
ReplyDeletePlease do report any FPC bugs you find in the FPC bug tracker at http://bugs.freepascal.org
ReplyDeleteNot doing so makes it much more likely that we'll miss them and that they won't be fixed in future versions.
Thanks!
The bug has been fixed in FPC svn: http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=19537
ReplyDeleteThanks, Jonas!
ReplyDeleteYou could undoubtedly go to your understanding the task you are writing. The arena hopes for far more fervent internet writers as you whom are not afraid to cover how they believe. All the time pursue a person's coronary heart.
ReplyDeleteHello, just wanted to say, I liked this blog post. It was practical. Keep on posting!
ReplyDeleteHi, just wanted to tell you, I enjoyed this post. It was inspiring. Keep on posting!
ReplyDelete