Hello,

I'm compiling the 3.6.21 amalgamation with Borland command-line compiler 
version 5.2 for Windows XP.
My compilation command is bcc32.exe -5 -H- -O2 -RT- -a8 -x- maintest.c sqlite3.c
where maintest.c is similar to the http://www.sqlite.org/quickstart.html sample 
C code.

The 3 SQL statements executed in maintest.c are:
SELECT datetime('now') as NOW;
SELECT datetime('now','utc') as UTC;
SELECT datetime('now','localtime') as MST;

Current local-time is 22:50 MST.
The results are:
NOW = 1601-01-01 00:04:49
UTC = 1601-01-01 07:04:49
MST = 1601-01-01 17:04:49

These are not as expected.

If I adjust function winCurrentTime() to use sqlite3_uint64 instead of 
sqlite3_int64 then the math for system time works out correctly.
I did this by adding option -DSQLITE_FIX_WINTIME=1 to my compiler command line 
and code modifications as show below.

Here are the results with unsigned int64:
NOW = 2010-02-05 05:51:05
UTC = 2010-02-05 12:51:05
MST = 2010-02-04 22:51:05

My compiler's defines are:
_INTEGRAL_MAX_BITS
__TLS__
__FLAT__
_Windows
__BORLANDC__
__CDECL__
__CONSOLE__
_MT
__CGVER__
__MT__
__BCOPT__
_CPPUNWIND
__TURBO__
_WIN32
_M_IX86
__WIN32__

Here is the code inserted immediately before winCurrentTime() function:
#if defined(SQLITE_FIX_WINTIME) && SQLITE_FIX_WINTIME
#define sqlite3_int64 sqlite3_uint64
#endif

Then the code inserted immediately after winCurrentTime() function:
#if defined(SQLITE_FIX_WINTIME) && SQLITE_FIX_WINTIME
#undef sqlite3_int64
#endif



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to