UTC offset question

1 view
Skip to first unread message

Cyrille

unread,
Nov 3, 2009, 11:51:40 PM11/3/09
to WellRailed
Hi guys,

Is UTC offset not working or am I looking at the wrong thing?

>> ActiveSupport::TimeZone.new("Wellington").utc_offset
=> 43200

43200/3600 = 12 hours

We are currently 13 hours ahead of UTC: http://www.timeanddate.com/worldclock/city.html?n=264

This is with Rails 2.2.2 and ruby 1.8.7 (2009-06-12 patchlevel 174)
[i686-darwin9.8.0], MBARI 0x8770, Ruby Enterprise Edition 20090928

Cheers.

PaulF

unread,
Nov 4, 2009, 12:57:50 AM11/4/09
to WellRailed
Hi Cyrille,

TimeZone class doesn't implement DST rules, but TimeWithZone class
does.

To get the DST offset use the TimeWithZone class
>> Time.current.utc_offset
=> 46800

But if you do the following its uses the TimeZone class
>> Time.zone.utc_offset
=> 43200

The conversation around this ticket explains its
https://rails.lighthouseapp.com/projects/8994/tickets/3037

Paul

Cyrille

unread,
Nov 4, 2009, 4:42:50 AM11/4/09
to WellRailed
Hi Paul,

thanks for pointing that out: the discussion on the ticket makes
sense, even though a different name like "utc_offset_without_dst"
would make it clearer...

Cheers!

Cyrille

On Nov 4, 6:57 pm, PaulF <paulflewell...@gmail.com> wrote:
> Hi Cyrille,
>
> TimeZone class doesn't implement DST rules, but TimeWithZone class
> does.
>
> To get the DST offset use the TimeWithZone class>> Time.current.utc_offset
>
> => 46800
>
> But if you do the following its uses the TimeZone class>> Time.zone.utc_offset
>
> => 43200
>
> The conversation around this ticket explains itshttps://rails.lighthouseapp.com/projects/8994/tickets/3037
Reply all
Reply to author
Forward
0 new messages