On 18 October 2010 09:28, Stephen Chrzanowski <pontia...@gmail.com> wrote: > I seem to be having an odd behavioral problem with calculating time stamps. > . . . > For instance: > > select strftime('%s','now') RealUTC,strftime('%s','now','localtime') > LocalTime, > strftime('%s','now') - strftime('%s','now','localtime') > > Yeilds results of: > RealUTC LocalTime strftime('%s','now') - > strftime('%s','now','localtime') > ---------- ---------- > ------------------------------------------------------------- > 1287389442 1290053442 -2664000
On my windoze7 m/c I set the time zone to Atlantic Time (Canada) (UTC -04:00), and executed your query in sqlite3 shell: SQLite version 3.6.11 Enter ".help" for instructions sqlite> select strftime('%s','now') RealUTC,strftime('%s','now','localtime') ...> LocalTime, ...> strftime('%s','now') - strftime('%s','now','localtime') ...> ; 1287394030|1287379630|14400 sqlite> I do not see the problem that you report > > I'm currently sitting in -0400 (EDT) and there should only be a maximum of > 14,400 seconds. 2664000 seems to add up to just under 31 days. > > Now, I'm writing the code that does the database management, and I've > modified it so that when inserting/updating the time, its done with the > date('2010-10-18 04:08:04','utc') to do the conversion, and the math works > without using UTC or LOCALTIME in the strftime functions but I'd still like > to know why the above SQL statement bombs? Regards, Simon _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users