Ah, yes paweld, just writing up the same explanation.
WP, Benny, are you using FPC322 ?
Looks like this is one of the many things that have been fixed in FPC323. I took my binary (compiled with fpc324rc1) to a PCLinux VM and it worked as expected. So I took the source and compiled it on PCLinux and it fails.
So, looking in the source of my App (which must compile with FPC322 on Debian) I realize I work around that problem. I vaguely recall reporting the issue and 'someone' fixed it, possibly PascalDragon. But of course, its not in the "Released Version" of FPC yet. Sigh ....
function MyTryISO8601ToDate(DateSt : string; out OutDT : TDateTime; ReturnUTC : boolean = true) : boolean;
var
I : integer;
St : string = '';
begin
OutDT := 0.0;
if DateSt = '' then exit(False);
Result := True;
I := pos('.', DateSt); // if we have decimal point, we have stuff to do.
if I > 0 then begin // TryISO8601ToDate cannot handle string with decimals of a second
delete(DateSt, I, 1); // Remove decimal point
while I < length(DateSt) do begin
if DateSt[I] in ['0'..'9'] then begin
St := St + DateSt[I]; // save digits to use later
delete(DateSt, I, 1);
end else break;
end;
// The first six digits in St represent microseconds. we will stop there.
while length(St) > 6 do delete(St, length(St), 1);
while length(St) < 6 do St := St + '0';
end;
if TryISO8601ToDate(DateSt, OutDT, ReturnUTC) then begin // WARNING - apparently this is a FPC320 only feature
if I > 0 then
OutDT := OutDT + (St.ToDouble() * ValueMicroSecond); // ValueMicroSecond is Regional const, eg
end else result := False; // ValueMicroSecond := 1.0 / double(24*60*60*1000*1000);
end;
Davo