#974 unconfirmed
Rich Collins

Conversion to Time from sqlite3

Reported by Rich Collins | July 14th, 2009 @ 08:23 PM

the sqlite3 adapter appears to ignore the timezone (uses local time) when retrieving records:

require 'rubygems'
require 'dm-core'

class Foo < Object
  include DataMapper::Resource
  property :id,       Serial
  property :birthday, Time

DataMapper.setup(:default, "sqlite3://box.db")

t = Time.now.utc
puts t
# Wed Jul 15 01:21:09 UTC 2009

f = Foo.new
f.birthday = t

puts Foo.first.birthday
# Wed Jul 15 01:21:09 -0700 2009

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) July 16th, 2009 @ 01:03 AM

    • Assigned user set to “Dirkjan Bussink”
    • State changed from “new” to “unconfirmed”
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) October 4th, 2009 @ 09:33 PM

    • Milestone changed from 0.10.0 to 0.10.2

    [project:id#20609 not-tagged:"0.10.0" milestone:id#51895 bulk edit command]

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) February 1st, 2010 @ 04:33 PM

    • Milestone changed from 0.10.2 to 1.0.0
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 26th, 2010 @ 01:11 AM

    • Milestone cleared.

    Removing this from the 1.0.0 Milestone because there has been no activity since July 2009.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 26th, 2010 @ 11:57 AM

    For now I would suggest that UTC be used across the board, that you persist UTC time, and expect that it is what is retrieved. Setting the TZ environment variable to "utc" should accomplish this.

    We're considering other approaches to this, similar to what they have in AR, where you set the default TZ, and all times are converted to that TZ when persisted. We don't really want a hard dependency on AS for this, but may accept it because it doesn't make sense to split this gem out from AS and maintain it ourselves. Further discussion is probably needed to find the right approach.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »