TFindFile "Invalid argument to date encode"

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

TFindFile "Invalid argument to date encode"

Postby ina » November 10th, 2011, 2:07 am

Just received a bug report from MadExcept.

Code: Select all
exception class   : EConvertError
exception message : Invalid argument to date encode.

0045724a +016 XXX.exe SysUtils              ConvertError
0045b689 +021 XXX.exe SysUtils              EncodeDate
0045b815 +011 XXX.exe SysUtils              SystemTimeToDateTime
005a3345 +021 XXX.exe FindFile      777  +3 FileTimeToDateTime
005a4a84 +094 XXX.exe FindFile     1554  +8 TFindFile.DoFileMatch
005a4e41 +181 XXX.exe FindFile     1663 +22 TFindFile.SearchIn
005a4f93 +2d3 XXX.exe FindFile     1684 +43 TFindFile.SearchIn
005a4caf +043 XXX.exe FindFile     1631  +7 TFindFile.SearchForFiles
005a487c +02c XXX.exe FindFile     1490  +3 TSearchThread.Execute

disassembling:
00457234 public SysUtils.ConvertError (PCMAV.exe):  ; function entry point
00457234   push    ebx
00457235   mov     ebx, eax
00457237   mov     ecx, ebx
00457239   mov     dl, 1
0045723b   mov     eax, [$456ba8]
00457240   call    +$65af ($45d7f4)       ; SysUtils.Exception.CreateRes (XXX.exe)
00457240
00457245   call    -$52156 ($4050f4)      ; System.@RaiseExcept (XXX.exe)
00457245
0045724a > pop     ebx
0045724b   ret


The error line is at "Result := SystemTimeToDateTime(SystemTime);'

Full code of the function

Code: Select all
function FileTimeToDateTime(const FileTime: TFileTime): TDateTime;
var
  LocalFileTime: TFileTime;
  SystemTime: TSystemTime;
begin
  FileTimeToLocalFileTime(FileTime, LocalFileTime);
  FileTimeToSystemTime(LocalFileTime, SystemTime);
  Result := SystemTimeToDateTime(SystemTime); << error
end;


I never get this error message in my computer, so I wonder how to prevent this error in other computer?
ina
Active Member
Active Member
 
Posts: 14
Joined: November 24th, 2009, 4:34 pm

Re: TFindFile "Invalid argument to date encode"

Postby Kambiz » December 18th, 2011, 3:28 pm

Is the date format identical on both computers?
You should consider localized format differences when converting a date, time, or number.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron