I noticed that over the clock change in the Autumn my wall clock continued to display summer time rather than winter time - my guess is that the Now function doesn't check for a change in the minutes offset very frequently, if at all since it was first called. Restarting the program fixed the problem, but it would be nice to have the fix in the code.
This with FPC for the Raspberry Pi.
Source:
http://www.satsignal.eu/raspberry-pi/DigitalClock.html
Code extract:
procedure TClockForm.TimerClockTimer (Sender: TObject);
var
when: TDateTime;
hours, minutes, seconds, th: Word;
begin
when := Now;
DecodeTime (when, hours, minutes, seconds, th);
if seconds FOldSeconds then
begin
FOldSeconds := seconds;
LabelHHMM.Caption := FormatDateTime ('hh:mm', when);
LabelHHMM.Update;
LabelSS.Caption := FormatDateTime (' ss', when);
LabelSS.Update;
if hours FOldHours then
begin
FOldHours := hours;
LabelDate.Caption := FormatDateTime ('yyyy-mmm-dd', when);
LabelDay.Caption := FormatDateTime ('dddd', when);
LabelDate.Left := (ClientWidth - LabelDate.Width) div 2;
LabelDay.Left := (ClientWidth - LabelDay.Width) div 2;
end;
end;
end;Thanks.
