samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

timezone information missing in database #96

Open zerobuzz opened 10 years ago

zerobuzz commented 10 years ago

hi,

i am often switching time zones when using timetrap, and i am painfully missing timezone information in the entries table. i propose to append the name of the local time zone to every datatime in the database, or, if no name is available, the +nnnn time zone spelling.

this would allow old databases to remain valid despite the fact that they do not keep track of timetrap release information. it would be possible to convert old to new databases heuristically setting a default time zone (users should probably get a warning before that happens).

with this change, it would be possible to work on planes on laptops that change local time based on the gps signal without timetrap getting confused. (-:

thanks! great tool!

samg commented 10 years ago

I think this is a great idea. I'd suggest that timetrap should probably always store time in utc and then present it in the local timezone, though you're correct that this could cause some backwards compatibility problems. From some very light research it looks like sqlite's datetime column doesn't support timezones so we'd need to standardize on one TZ (i.e. UTC) and convert on display. It's probably unlikely that I'll be able to work on this in the short term, though I'd happily review pull requests to add timezone support.