#1059 unconfirmed

Strange behavior with Time type.

Reported by robert | September 23rd, 2009 @ 06:12 PM


I am experiencing strange behavior when trying to store a Time object in the GMT timezone.

cookie_expires_at = (Time.now + (60*60)*1).gmtime
puts cookie_expires_at # => 2009-09-24 00:07:43 UTC

This variable is passed to "response.set_cookie()" (Using Sinatra/Rack), but shouldn't matter.

It is stored in the database as follows:

def Session.store_session session_id, params, expires_at

Session.transaction do

  Session.create!(:session_id => session_id,
          :params     => params,
          :expires    => expires_at)



The :expires column is set to be of type, Time.

The Time object i receive from the database looks like this:
2009-09-24 00:07:43 +0100

In the database, the entry looks like this:

As you can see, somewhere along the line, the fact that the Time object is in the GMT timezone is lost somewhere.
If I want to compare Time.now.gmtime and the value presented by DataMapper, there will be inaccuracies.

Comments and changes to this ticket

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 »