Mein Endergebnis sieht jetzt übrigens so aus. Ich habe auf JclFileUtils gewechselt, da die ein wenig schneller sind
Delphi-Quellcode:
function FileTimeToDateTime(FileTime: TFileTime): TDateTime;
var
ModifiedTime: TFileTime;
SystemTime: TSystemTime;
begin
Result := 0;
if (FileTime.dwLowDateTime = 0) and (FileTime.dwHighDateTime = 0) then
Exit;
try
FileTimeToLocalFileTime(FileTime, ModifiedTime);
FileTimeToSystemTime(ModifiedTime, SystemTime);
Result := SystemTimeToDateTime(SystemTime);
except
Result := Now; // Something to return in case of error
end;
end;
function TForm8.getPathLastWriteTime(const aPathName: string): TDateTime;
begin
try
Result := FileTimeToDateTime(JclFileUtils.GetFileLastWrite(aPathName)); // TDirectory.GetLastWriteTime(aPathName);
except
Result := 0;
end;
end;
function TForm8.getFileLastWriteTime(const aFileName: string): TDateTime;
begin
Result := functions.getPathLastWriteTime(aFileName);
end;