<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I did run test program on RaspberryPI: Linux+ARM and results are
as expected.<br>
(FPC 3.2.0)</p>
<p>-Laco.<br>
</p>
<div class="moz-cite-prefix">Dňa 9.3.2021 o 1:47 Toru Takubo via
fpc-pascal napísal(a):<br>
</div>
<blockquote type="cite"
cite="mid:731beff3-5ee4-bc0c-13f5-fa111324af29@e-parcel.co.jp">On
2021/03/08 16:54, Michael Van Canneyt via fpc-pascal wrote:
<br>
<blockquote type="cite">
<br>
<br>
On Mon, 8 Mar 2021, Toru Takubo via fpc-pascal wrote:
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
I am developing my app on Windows and building apps for other
<br>
platforms by using cross compiler. Now I have a problem only
<br>
occurred on Linux ARM.
<br>
<br>
The problem is that it cannot write datetime field on sqlite3
<br>
database. It can read/write other fields like int, varchar
<br>
or blob, but always write zero in datetime (maybe float as
well)
<br>
field.
<br>
<br>
Does anyone have an idea about this issue? I am not sure it is
<br>
fpc issue, but better to report bug?
<br>
</blockquote>
<br>
It sounds like a floating point problem. As you probably know, a
TDateTime
<br>
type is actually a double type. Did you try with a float value ?
<br>
<br>
The DB explorer tools probably just use strings to read/write
from the
<br>
database, so they will not be bothere by such things, but FPC
stores dataset
<br>
values in 'native' formats in memory.
<br>
<br>
I don't know what to advise to further investigate the issue,
One thing to
<br>
try would be to test whether normal float arithmetic or date
arithmetic works.
<br>
If not, then the compiler people will need to give more advice.
<br>
<br>
</blockquote>
<br>
I created a simple test code, and ran on linux-i386 and linux-arm.
<br>
Test on linux-i386 is OK but on linux-arm, I got unexpected values
<br>
"30-12-99" as datetime and "2.12199579096527E-314" as float, which
are different
<br>
from values previously set. (except INT and VARCHAR fields)
<br>
<br>
---linux-i386--------------------------------------------
<br>
INT, VARCHAR, DATETIME, DOUBLE
<br>
0, 9-3-21 08:50:23, 9-3-21 08:50:23, 0
<br>
1, 9-3-21 12:16:06, 9-3-21 12:16:06, 0.142857142857143
<br>
2, 9-3-21 15:41:49, 9-3-21 15:41:49, 0.285714285714286
<br>
3, 9-3-21 19:07:32, 9-3-21 19:07:32, 0.428571428571429
<br>
4, 9-3-21 22:33:15, 9-3-21 22:33:15, 0.571428571428571
<br>
5, 10-3-21 01:58:58, 10-3-21 01:58:58, 0.714285714285714
<br>
6, 10-3-21 05:24:40, 10-3-21 05:24:40, 0.857142857142857
<br>
7, 10-3-21 08:50:23, 10-3-21 08:50:23, 1
<br>
8, 10-3-21 12:16:06, 10-3-21 12:16:06, 1.14285714285714
<br>
9, 10-3-21 15:41:49, 10-3-21 15:41:49, 1.28571428571429
<br>
<br>
---linux-arm---------------------------------------------
<br>
INT, VARCHAR, DATETIME, DOUBLE
<br>
0, 9-3-21 08:55:53, 30-12-99, 2.12199579096527E-314
<br>
1, 9-3-21 12:21:36, 30-12-99, 2.12199579096527E-314
<br>
2, 9-3-21 15:47:18, 30-12-99, 2.12199579096527E-314
<br>
3, 9-3-21 19:13:01, 30-12-99, 2.12199579096527E-314
<br>
4, 9-3-21 22:38:44, 30-12-99, 2.12199579096527E-314
<br>
5, 10-3-21 02:04:27, 30-12-99, 2.12199579096527E-314
<br>
6, 10-3-21 05:30:10, 30-12-99, 2.12199579096527E-314
<br>
7, 10-3-21 08:55:53, 30-12-99, 2.12199579096527E-314
<br>
8, 10-3-21 12:21:36, 30-12-99, 2.12199579096527E-314
<br>
9, 10-3-21 15:47:19, 30-12-99, 2.12199579096527E-314
<br>
<br>
I used a shared library libsqlite3.so included in the "DB Browser
for SQLite",
<br>
so it should work. What can cause such a problem only in the
specific field
<br>
on the specific platform?
<br>
<br>
Thank you in advance for any advice.
<br>
<br>
Toru
<br>
<br>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
</body>
</html>