* make statx based Sysutils.FileAge working with relative pathes

+ test

git-svn-id: trunk@48519 -
(cherry picked from commit b08717fef6)
This commit is contained in:
florian 2021-02-07 17:41:27 +00:00 committed by marcoonthegit
parent a67b55f7fe
commit 43f3819feb
2 changed files with 9 additions and 1 deletions

View File

@ -574,7 +574,7 @@ begin
{$ifdef USE_STATX}
{ first try statx }
if (statx(0,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
if (statx(AT_FDCWD,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
begin
Result:=Infox.stx_mtime.tv_sec;
exit;

View File

@ -7,4 +7,12 @@ begin
writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
halt(1);
end;
{ test with relative path }
if 3600*24*(now()-FileDateToDateTime(FileAge(ExtractRelativePath(GetCurrentDir+DirectorySeparator,paramstr(0)))))>7200 then
begin
writeln('FileAge returns: ',FileDateToDateTime(FileAge(paramstr(0))));
writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
halt(1);
end;
end.