[#37050] [Feature #735] Date#inspect — "rubikitch ." <redmine@...>

Feature #735: Date#inspect

14 messages 2008/11/09

[#37075] [Feature #747] /\A/u ignores BOM — Shyouhei Urabe <redmine@...>

Feature #747: /\A/u ignores BOM

14 messages 2008/11/12

[#37161] m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...>

Yuguiです。

35 messages 2008/11/24
[#37183] Re: m17n of irb — keiju@... (keiju ISHITSUKA) 2008/11/25

けいじゅ@いしつかです.

[#37203] Re: m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...> 2008/11/26

keiju ISHITSUKA さんは書きました:

[#37292] Re: m17n of irb — Yukihiro Matsumoto <matz@...> 2008/12/06

まつもと ゆきひろです

[#37293] Re: m17n of irb — "Yugui (Yuki Sonoda)" <yugui@...> 2008/12/07

Yuguiです。

[#37298] Re: m17n of irb — Yukihiro Matsumoto <matz@...> 2008/12/07

まつもと ゆきひろです

[#37210] RSS::Maker.create(version) — "Akinori MUSHA" <knu@...>

 RSS::Maker で、 "2.0" 等の文字列でフィードのフォーマットを渡す

15 messages 2008/11/27

[#37213] Re: [ruby-cvs:27586] Ruby:r20368 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return — Tadayoshi Funaba <tadf@...>

> * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return

8 messages 2008/11/27

[ruby-dev:37126] Re: [ruby-cvs:27470] Ruby:r20251 (trunk): * lib/time.rb: according to RFC2822, -0000 means local time, +0000

From: Tanaka Akira <akr@...>
Date: 2008-11-19 06:39:25 UTC
List: ruby-dev #37126
In article <200811181512.mAIFC3YP006108@ci.ruby-lang.org>,
  matz@ruby-lang.org writes:

> matz	2008-11-19 00:12:02 +0900 (Wed, 19 Nov 2008)
>
>   New Revision: 20251
>
>   http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20251
>
>   Log:
>     * lib/time.rb: according to RFC2822, -0000 means local time, +0000
>       means UTC.  a patch from Chun Wang.   [ruby-core:19578]

これはどうなんですかねぇ。

とりあえず、冬のロンドンで、以下のように
Time.rfc8222(time.rfc2822) で、UTC かどうかがラウンドトリッ
プしなくなります。

% TZ=Europe/London ./ruby -v -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
ruby 1.9.0 (2008-11-19 revision 20285) [i686-linux]
2008-12-01 00:00:00 UTC
% TZ=Asia/Tokyo ./ruby -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
2008-12-01 00:00:00 +0900

Time.local は地方時の Time オブジェクトを生成し、Time#rfc2822
で文字列化して、Time.rfc2822 で戻すと、ロンドンでは UTC になっ
てしまいます。東京では地方時のままになりますが。

変更前であれば、ちゃんとラウンドトリップします。

% TZ=Europe/London ruby -v -rtime -e 'p Time.rfc2822(Time.local(2008,12,1).rfc2822)'
ruby 1.9.0 (2008-10-02 revision 19663) [i686-linux]
2008-12-01 00:00:00 +0000

もとの指摘については、RFC 2822 の

   minutes).  The form "+0000" SHOULD be used to indicate a time zone at
   Universal Time.  Though "-0000" also indicates Universal Time, it is
   used to indicate that the time was generated on a system that may be
   in a local time zone other than Universal Time and therefore
   indicates that the date-time contains no information about the local
   time zone.

という記述が問題なんですが、a time zone at Universal Time と
いうのは冬のイギリスなどを意味していて、地方時を意味するので
はないだろうかと思っています。

そして、no information about the local time zone であること
を示すのは UTC を対応させるのがいいんじゃないかと考えていま
す。

なにか読み間違っていたり、変だったりしますかね?

パッチのように、-0000 を地方時にすると、冬のロンドンが
no information about the local time zone となりますが、こ
れは奇妙です。

まぁ、Time クラスにはしょせん utc/localtime の 2状態しかなく
て、RFC 2822 の形式には時差が 0 のものが +0000, -0000, GMT
と (少なくとも) 3種類ありますから、1対1 に写像できないのはしょ
うがなくて、ある程度いびつにならざるを得ないんですが、この中
で時差が 0 の地方時に対応するものを選ぶとしたら +0000 が適切
だと思います。

あと、パッチのようにひっくりかえすと、1.8 と 1.9 の間で RFC
2822 の形式で時刻をやりとりしたとときに UTC かどうかが反転す
るという問題もあります。本当に間違っているなら反転するのもや
むを得ないかもしれませんが、現在のところそうは思っていません。
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread

Prev Next