Bug #691

Time::zone_utc? does not follow rfc2822

Added by Chun Wang over 3 years ago. Updated 10 months ago.

[ruby-core:19578]
Status:Closed Start date:10/29/2008
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:core
Target version:1.9.0-5
ruby -v:

Description

The original author seems misunderstood the specification. in rfc2822, '+0000' should be considered as utc.

diff (7.7 kB) Chun Wang, 10/29/2008 02:55 am

Associated revisions

Revision 20251
Added by Yukihiro Matsumoto about 3 years ago

* lib/time.rb: according to RFC2822, -0000 means local time, +0000 means UTC. a patch from Chun Wang. [ruby-core:19578]

History

Updated by Yukihiro Matsumoto about 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r20251.

Updated by Yukihiro Matsumoto about 3 years ago

Akira Tanaka claimed that by this change Time#rfc2822 no longer round trip in [ruby-dev:37126].

% TZ=Europe/London ./ruby -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
2008-12-01 00:00:00 UTC

It used to go round.
% TZ=Europe/London ruby -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
2008-12-01 00:00:00 +0000

I am afraid this is bad.

He also suspects "a time zone at Universal Time" to mean a local time which has zero hour difference from UTC (London e.g.), not UTC itself.

Updated by Martin Dürst about 3 years ago

At 18:53 08/11/19, Yukihiro Matsumoto wrote:
>Issue #691 has been updated by Yukihiro Matsumoto.
>
>
>Akira Tanaka claimed that by this change Time#rfc2822 no longer round trip 
>in [ruby-dev:37126].
>
>% TZ=Europe/London ./ruby -rtime -e 'p 
>Time.rfc2822(Time.local(2008,12,1).rfc2822)'
>2008-12-01 00:00:00 UTC
>
>It used to go round.
>% TZ=Europe/London ruby -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
>2008-12-01 00:00:00 +0000
>
>I am afraid this is bad.
>
>He also suspects "a time zone at Universal Time" to mean a local time which 
>has zero hour difference from UTC (London e.g.), not UTC itself.

I can see no other way to interpret this.

However, having looked at the Ruby Time class, I think it is
built under the assumption that the ("physical") time zone is
always known. This is okay for exact calculations, but it is
often not appropriate in business processes and the like.

As a simple example, a meeting scheduled at 15:00 on Mondays
in London doesn't usually move to 16:00 during summer time.

My understanding is that the -00:00 notation as used by RFC 2822
is used to indicate "timezone unknown". Ideally, Ruby would have
a way to represent internally that the timezone is unknown.
But I guess that would make the Time class quite a bit more
complicated. As a fallback, it should be documented that the
Ruby Time class has this limitation, and that it assumes the
local/process timezone when none is given (as e.g. with the -00:00
notation).

Regards,   Martin.

P.S.: See also http://www.w3.org/TR/timezone/ for more background.


#-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-#  http://www.sw.it.aoyama.ac.jp       mailto:duerst@it.aoyama.ac.jp     

Also available in: Atom PDF