
Strange behavior with Time type.
Reported by robert | September 23rd, 2009 @ 06:12 PM
Hi,
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)
end
end
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:
2009-09-24T00:07:43.339917+00:00
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
-
Dan Kubb (dkubb) September 24th, 2009 @ 01:47 PM
- State changed from new to unconfirmed
- Assigned user set to Dirkjan Bussink
@Dirkjan: Is this related to some of the other TZ related issues in DO?
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »