It's not the filesystem that's at fault. The problem is the File
DateToDateTime() function in FPC. It is not accurate enough to translate milliseconds. If you use the File
TimeToDateTime() in jcl you'll get your milliseconds.
uses Windows;
const
FileTimeBase = -109205.0;
FileTimeStep: Extended = 24.0 * 60.0 * 60.0 * 1000.0 * 1000.0 * 10.0; // 100 nSek per Day
function FileTimeToDateTime(const FileTime: TFileTime): TDateTime;
begin
Result := Int64(FileTime) / FileTimeStep;
Result := Result + FileTimeBase;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
F: TSearchRec;
Local: TFileTime;
begin
memo1.clear;
FindFirst('project1.exe', faAnyFile and not faDirectory, F);
try
FileTimeToLocalFileTime(F.FindData.ftCreationTime, Local);
memo1.lines.add('Created: ' + FormatDateTime('dd.mm.yyyy hh:nn:ss.zzz', FileTimeToDateTime(Local)));
FileTimeToLocalFileTime(F.FindData.ftLastAccessTime, Local);
memo1.lines.add('Last access: ' + FormatDateTime('dd.mm.yyyy hh:nn:ss.zzz', FileTimeToDateTime(Local)));
FileTimeToLocalFileTime(F.FindData.ftLastWriteTime, Local);
memo1.lines.add('Last write: ' + FormatDateTime('dd.mm.yyyy hh:nn:ss.zzz', FileTimeToDateTime(Local)));
finally
SysUtils.FindClose(F);
end;
end;
(You'll need to adjust for your local-time but there are function for that too, i.e. FileTimeToLocalFileTime)
My result (for project1.exe in %temp%, hence the old creation date)
Created: 01.10.2016 18:39:04.443
Last access: 01.10.2016 18:39:04.443
Last write: 08.10.2016 17:09:38.869Saving the project elsewhere and doing it again you'll get:
Created: 08.10.2016 17:12:24.227
Last access: 08.10.2016 17:12:24.227
Last write: 08.10.2016 17:12:26.016So yeah, this is really due to an inaccuracy in FPC.