Page 1 of 1

SQLite time zone?

PostPosted: Fri Oct 05, 2012 6:12 pm
by gabbas
I just enabled the SQL Logger Plugin in SQLite mode, and mostly it looks really straightforward. I noticed something interesting though: the event log and device history tables seem to be in different time zones. Is this intentional? Is there a way to get them to use the same time zone? (Besides telling my Mac to pretend it's in London. :-)) For instance, my event log says this:

18|2012-10-05 16:59:43|False|11|Sent INSTEON|"Deck Plants" on to 100

but the corresponding entry in the device history is this:

3|2012-10-05 23:59:44|100|True

Notice the 7 hour time difference (I live in California). Suggestions please?

Re: SQLite time zone?

PostPosted: Fri Oct 05, 2012 8:22 pm
by matt (support)
This definitely looks like a bug. Consistency would be nice. ;-)

Despite the way it might appear, the device history table is correct and the event history table is wrong. We store timestamps in UTC, which PostgreSQL handles automatically but when using SQLite you need to select 'ts' as 'datetime(ts,'localtime')'. Doing so should show the time you expect for the device table.

The next version of Indigo 5.1 will include an updated SQL Logger plugin (v1.1.2) that stores the event log times correctly for SQLite. Note, unfortunately, you'll need to delete your SQLite database file and let the plugin recreate it (the fix required a tweak to the table definition itself).

Re: SQLite time zone?

PostPosted: Sat Oct 06, 2012 1:57 pm
by gabbas
Okay cool. Thanks Matt!