From e0299e97550de65d825dfe55aca7d8ac8ecca8d1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 17 Jun 2010 16:39:36 -0700 Subject: [PATCH] setting the timezone in postgres to whatever ruby thinks the timezone is [#4895 state:resolved] --- .../connection_adapters/postgresql_adapter.rb | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index bb8850f..e842426 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -927,7 +927,12 @@ module ActiveRecord # If using Active Record's time zone support configure the connection to return # TIMESTAMP WITH ZONE types in UTC. - execute("SET time zone 'UTC'") if ActiveRecord::Base.default_timezone == :utc + if ActiveRecord::Base.default_timezone == :utc + execute("SET time zone 'UTC'") + else + offset = Time.local(2000).utc_offset / 3600 + execute("SET time zone '#{offset}'") + end end # Returns the current ID of a table's sequence. -- 1.7.0.6