wie kann ich Uhrzeit & Datum per Lazarus Programm unter Linux neu setzen? In einem Delphi / Windows Programm hatte ich das so gelöst:
Code: Alles auswählen
PROCEDURE TForm1.Button1Click (Sender : TObject); // PC Uhr einstellen
VAR NewDateTime : TSystemTime;
BEGIN { TForm1.Button3Click }
FillChar (NewDateTime, SizeOf (NewDateTime), #0);
WITH NewDateTime DO
BEGIN
wYear := StrToInt (Copy (EditDate.Text, 7, 2)) + 2000;
wMonth := StrToInt (Copy (EditDate.Text, 4, 2));
wDay := StrToInt (Copy (EditDate.Text, 1, 2));
wHour := StrToInt (Copy (EditTime.Text, 1, 2));
wMinute:= StrToInt (Copy (EditTime.Text, 4, 2));
wSecond:= StrToInt (Copy (EditDate.Text, 7, 2));
wMilliseconds:= 0;
END { with NewDateTime };
IF (SetLocalTime (NewDateTime)) = TRUE THEN ShowMessage ('Uhr neu gestellt')
ELSE ShowMessage ('als Admin starten')
END { TForm1.Button1Click };