* statx based Sysutils.FileGetDate with handle fixed

+ test

git-svn-id: trunk@48520 -
(cherry picked from commit 3e453f92fc)
This commit is contained in:
florian 2021-02-07 17:59:28 +00:00 committed by marcoonthegit
parent dcde27b8c6
commit 1202d9d492
2 changed files with 9 additions and 1 deletions

View File

@ -1082,10 +1082,12 @@ Var
{$ifdef USE_STATX}
Infox : TStatx;
{$endif USE_STATX}
Char0 : char;
begin
Result:=-1;
{$ifdef USE_STATX}
if statx(Handle,nil,0,STATX_MTIME,Infox)=0 then
Char0:=#0;
if statx(Handle,@Char0,AT_EMPTY_PATH,STATX_MTIME,Infox)=0 then
Result:=Infox.stx_Mtime.tv_sec
else if fpgeterrno=ESysENOSYS then
{$endif USE_STATX}

View File

@ -39,6 +39,12 @@ BEGIN
do_error(1003);
Close(f);
Assign(f,'datetest.dat');
Reset(f);
if FileGetDate(filerec(f).handle)<>DateTimeToFileDate(dateTime) then
do_error(1004);
Close(f);
if FileExists('datetest.dat') then
begin
Assign(f,'datetest.dat');