View unanswered posts | View active topics It is currently Fri May 24, 2013 5:22 am



Reply to topic  [ 3 posts ] 
 SQLite time zone? 
Author Message

Joined: Jun 22, 2008
Posts: 19
Post SQLite time zone?
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?


Fri Oct 05, 2012 6:12 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11697
Location: Texas
Post Re: SQLite time zone?
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).

_________________
Image


Fri Oct 05, 2012 8:22 pm
Profile WWW

Joined: Jun 22, 2008
Posts: 19
Post Re: SQLite time zone?
Okay cool. Thanks Matt!


Sat Oct 06, 2012 1:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.