I was unable to duplicate your error with the CLI and 3.6.22 (compiled with
cygwin\gcc or msvc):

SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT datetime('now') as NOW;
2010-02-05 16:33:50
sqlite> SELECT datetime('now','utc') as UTC;
2010-02-05 21:33:50
sqlite> SELECT datetime('now','localtime') as MST;
2010-02-05 11:33:50

The date/time functions are described at
http://www.sqlite.org/lang_datefunc.html

It states that the '"utc" assumes that the string to its left is in the
local timezone and adjusts that string to be in UTC' so I think at least the
results for datetime('now','utc') are consistent.

-Shane

On Fri, Feb 5, 2010 at 1:04 AM, <4ean...@engineer.com> wrote:

>
>
>
>  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.htmlsample 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
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to