views:

87

answers:

2

Newly compiled SQLite displays a strange behavior concerning the date/time functions. Do you have any idea what is going on and how to fix it?

    $ date
    Mon Mar  8 14:52:11 CET 2010

    $ ./sqlite3 TEST0
    SQLite version 3.6.22
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> SELECT date('now');
    -4713-11-24

    sqlite> SELECT strftime('%s','now');
    -210866760000

    sqlite> select datetime( -210866760000 , 'unixepoch');
    1970-01-01 00:00:00

The version is SQLite 3_6_22 for ARM-Linux. I'm not sure...maybe some crosscompilation problems?

+1  A: 

Looks like SQLite can't access the clock for some reason so it's assuming a date of zero. It uses the Julian Day for its internal date represenation, so this converts to -4713-11-24 12:00:00.

dan04
A: 

...make sure the compilation is adjusted for your specific model of ARM ( -mtune=arm920t ) instead of just generic armel, arm9 and the likes. Otherwise the program works okay in general, but doesn't get access to various features like the clock...

SF.