Hello guys, I made a program for the management of inputs and outputs for employees, and when it does not read the card rfid user shows the current time! Up to the end of October no problem, the date was correct. But from November, which came into use solar time I show the wrong time. It shows me the summer time! A now on. The funny thing is that if a terminal (this is a raspberry) launch the "date" command back to me the correct value. Who tells me what's wrong with this procedure?
procedure TFrm_Main.Timer1Timer(Sender: TObject);
Var
YY,MM,DD : Word;
HH,Minuti,SS,MS: Word;
ora_str: string;
data_str: string;
begin
try
try
if IsRunningResult=false then
begin
DecodeDate(Date,YY,MM,DD);
DecodeTime(Time,HH,Minuti,SS,MS);
data_str:='';
if DD<10 then
data_str:=data_str + '0';
data_str:=data_str + IntToStr(DD) + '/';
if MM<10 then
data_str:=data_str + '0';
data_str:=data_str + IntToStr(MM) + '/';
data_str:=data_str + IntToStr(YY);
ora_str:='';
if hh<10 then
ora_str:=ora_str + '0';
ora_str:=ora_str + IntToStr(hh) + ':';
if Minuti<10 then
ora_str:=ora_str + '0';
ora_str:=ora_str + IntToStr(Minuti) + ':';
if ss<10 then
ora_str:=ora_str + '0';
ora_str:=ora_str + IntToStr(ss);
Self.Lbl_Data_Ora.Font.Color:=RGBToColor(112,113,115);
Self.Lbl_Data_Ora.Visible:=true;
Self.Lbl_Data_Ora.Caption:= data_str + ' ' + ora_str;
Self.Refresh;
Application.ProcessMessages;
end;
finally
//codice da effettuare a fine procedura sia che va bene il codice sopra sia che il codice ha sollevato un'eccezzione
end;
except
on E: Exception do
begin
Self.Log('[Timer1] ' + E.Message);
end;
end;
end;
On raspberry in question there is a cron that runs the following script
#!/bin/bash
echo Inizio sincronizzazione attraverso ntpupdate
sudo ntpdate 192.168.27.1
echo Sincronizzazione avvenuta