Page 1 of 1

DateTime 00/00/0000

Posted: 07.02.2019, 11:31
by xinyiman
Hi guys, I use lazarus 2.1 with zeoslib 7.2 stable. When I compile from windows with target windows it works fine, when I use the cross compilation to cocoa (darwin 64 bit) any query that has a date returns me 00/00/0000.
Why? How can I make them work properly?

Re: DateTime 00/00/0000

Posted: 07.02.2019, 20:48
by marsupilami
Hmmm - that sounds strange. Could you please provide a small sample application or sample procedure and a database script that demonstrate the problem? This greatly helps us in debugging the issue. Problem here is that no one of the team has a mac to test those things...

Re: DateTime 00/00/0000

Posted: 07.02.2019, 22:19
by xinyiman
Ok, into test.zip exists my lazarus example, my firebird backup test.fbk and one image of my execution with problem.

Idea?

Re: DateTime 00/00/0000

Posted: 09.02.2019, 13:16
by xinyiman
To exclude that the problem was of lazarus or of fpc I tried to compile the same program without the zeos components and replacing them with the TIBConnection. As seen from the image with TIBConnection it works, so the problem is prorpio in zeos.

Re: DateTime 00/00/0000

Posted: 09.02.2019, 19:31
by xinyiman
I found the problem but I do not know how to solve it. The DateTimeToNative function exists in the ZDatasetUtils file.

Which has the following line

TDateTime (Buffer ^): = TimeStampToMSecs (TimeStamp);

If I put the following code
var
app2: comp;
...
app2: = TimeStampToMSecs (TimeStamp);
writeln (FloatToStr (app2));

I get the following values on windows

07/02/2019 21:42:20
floattostr: 63685258940708

and on the following macs
07/02/2019 22:14:33
floattostr: -9.22337203685478E18

I know that the two dates are different, but the fact that the value on the mac is negative leads me to think that there is a problem. Ideas on how to solve it?

Re: DateTime 00/00/0000

Posted: 11.02.2019, 08:58
by xinyiman
So, I installed lazarus + fpc on mac os directly. Before I did a cross compilation from windows. If I install the problem directly it does not exist. Now I do not understand if there is any kind of incompatibility or the problem has been solved at the fpc or lazarus level in this version I installed.

Re: DateTime 00/00/0000

Posted: 15.02.2019, 08:22
by marsupilami
Hello xinyiman,

this sounds like a problem in FPC if a cross compiled executable behaves differently from an executable that was compiled by the native compiler. Maybe it makes sense to report that on the FPC mailing list or to open a bug report.

Best regards,

Jan

Re: DateTime 00/00/0000

Posted: 15.02.2019, 11:20
by Fr0sT
Seems it's not a Zeos issue. Investigate further, are timestamp structures differ? Or binary representations of results of TimeStampToMSecs ?