[前][次][番号順一覧][スレッド一覧]

ruby-changes:8800

From: matz <ko1@a...>
Date: Mon, 24 Nov 2008 18:38:25 +0900 (JST)
Subject: [ruby-changes:8800] Ruby:r20335 (trunk): * lib/time.rb: r20251 reverted. The patched behavior do not round

matz	2008-11-24 18:38:00 +0900 (Mon, 24 Nov 2008)

  New Revision: 20335

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20335

  Log:
    * lib/time.rb: r20251 reverted.  The patched behavior do not round
      trip.  [ruby-core:19988]

  Modified files:
    trunk/ChangeLog
    trunk/lib/time.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20334)
+++ ChangeLog	(revision 20335)
@@ -1,3 +1,8 @@
+Mon Nov 24 18:35:00 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* lib/time.rb: r20251 reverted.  The patched behavior do not round
+	  trip.  [ruby-core:19988]
+
 Sun Nov 23 16:04:05 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* signal.c (default_handler, Init_signal): compile error if
Index: lib/time.rb
===================================================================
--- lib/time.rb	(revision 20334)
+++ lib/time.rb	(revision 20335)
@@ -84,9 +84,9 @@
     end
 
     def zone_utc?(zone)
-      # * -0000 means localtime. [RFC 2822]
+      # * +0000 means localtime. [RFC 2822]
       # * GMT is a localtime abbreviation in Europe/London, etc.
-      if /\A(?:\+00:00|\+0000|\+00|UTC|Z|UT)\z/i =~ zone
+      if /\A(?:-00:00|-0000|-00|UTC|Z|UT)\z/i =~ zone
         true
       else
         false
@@ -409,7 +409,7 @@
   #
   # where zone is [+-]hhmm.
   #
-  # If +self+ is a UTC time, +0000 is used as zone.
+  # If +self+ is a UTC time, -0000 is used as zone.
   #
   def rfc2822
     sprintf('%s, %02d %s %d %02d:%02d:%02d ',
@@ -417,7 +417,7 @@
       day, RFC2822_MONTH_NAME[mon-1], year,
       hour, min, sec) +
     if utc?
-      '+0000'
+      '-0000'
     else
       off = utc_offset
       sign = off < 0 ? '-' : '+'
@@ -730,86 +730,86 @@
 
     def test_zone_0000
       assert_equal(true, Time.parse("2000-01-01T00:00:00Z").utc?)
-      assert_equal(true, Time.parse("2000-01-01T00:00:00+00:00").utc?)
-      assert_equal(false, Time.parse("2000-01-01T00:00:00-00:00").utc?)
+      assert_equal(true, Time.parse("2000-01-01T00:00:00-00:00").utc?)
+      assert_equal(false, Time.parse("2000-01-01T00:00:00+00:00").utc?)
       assert_equal(false, Time.parse("Sat, 01 Jan 2000 00:00:00 GMT").utc?)
-      assert_equal(true, Time.parse("Sat, 01 Jan 2000 00:00:00 +0000").utc?)
-      assert_equal(false, Time.parse("Sat, 01 Jan 2000 00:00:00 -0000").utc?)
+      assert_equal(true, Time.parse("Sat, 01 Jan 2000 00:00:00 -0000").utc?)
+      assert_equal(false, Time.parse("Sat, 01 Jan 2000 00:00:00 +0000").utc?)
       assert_equal(false, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 GMT").utc?)
-      assert_equal(true, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 +0000").utc?)
-      assert_equal(false, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 -0000").utc?)
+      assert_equal(true, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 -0000").utc?)
+      assert_equal(false, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 +0000").utc?)
       assert_equal(true, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 UTC").utc?)
     end
 
     def test_parse_leap_second
       t = Time.utc(1998,12,31,23,59,59)
       assert_equal(t, Time.parse("Thu Dec 31 23:59:59 UTC 1998"))
-      assert_equal(t, Time.parse("Fri Dec 31 23:59:59 +0000 1998"));t.localtime
+      assert_equal(t, Time.parse("Fri Dec 31 23:59:59 -0000 1998"));t.localtime
       assert_equal(t, Time.parse("Fri Jan  1 08:59:59 +0900 1999"))
       assert_equal(t, Time.parse("Fri Jan  1 00:59:59 +0100 1999"))
-      assert_equal(t, Time.parse("Fri Dec 31 23:59:59 -0000 1998"))
+      assert_equal(t, Time.parse("Fri Dec 31 23:59:59 +0000 1998"))
       assert_equal(t, Time.parse("Fri Dec 31 22:59:59 -0100 1998"));t.utc
       t += 1
       assert_equal(t, Time.parse("Thu Dec 31 23:59:60 UTC 1998"))
-      assert_equal(t, Time.parse("Fri Dec 31 23:59:60 +0000 1998"));t.localtime
+      assert_equal(t, Time.parse("Fri Dec 31 23:59:60 -0000 1998"));t.localtime
       assert_equal(t, Time.parse("Fri Jan  1 08:59:60 +0900 1999"))
       assert_equal(t, Time.parse("Fri Jan  1 00:59:60 +0100 1999"))
-      assert_equal(t, Time.parse("Fri Dec 31 23:59:60 -0000 1998"))
+      assert_equal(t, Time.parse("Fri Dec 31 23:59:60 +0000 1998"))
       assert_equal(t, Time.parse("Fri Dec 31 22:59:60 -0100 1998"));t.utc
       t += 1 if t.sec == 60
       assert_equal(t, Time.parse("Thu Jan  1 00:00:00 UTC 1999"))
-      assert_equal(t, Time.parse("Fri Jan  1 00:00:00 +0000 1999"));t.localtime
+      assert_equal(t, Time.parse("Fri Jan  1 00:00:00 -0000 1999"));t.localtime
       assert_equal(t, Time.parse("Fri Jan  1 09:00:00 +0900 1999"))
       assert_equal(t, Time.parse("Fri Jan  1 01:00:00 +0100 1999"))
-      assert_equal(t, Time.parse("Fri Jan  1 00:00:00 -0000 1999"))
+      assert_equal(t, Time.parse("Fri Jan  1 00:00:00 +0000 1999"))
       assert_equal(t, Time.parse("Fri Dec 31 23:00:00 -0100 1998"))
     end
 
     def test_rfc2822_leap_second
       t = Time.utc(1998,12,31,23,59,59)
       assert_equal(t, Time.rfc2822("Thu, 31 Dec 1998 23:59:59 UTC"))
-      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 +0000"));t.localtime
+      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 -0000"));t.localtime
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 08:59:59 +0900"))
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:59:59 +0100"))
-      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 -0000"))
+      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:59 +0000"))
       assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:59 -0100"));t.utc
       t += 1
       assert_equal(t, Time.rfc2822("Thu, 31 Dec 1998 23:59:60 UTC"))
-      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 +0000"));t.localtime
+      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 -0000"));t.localtime
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 08:59:60 +0900"))
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:59:60 +0100"))
-      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 -0000"))
+      assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:59:60 +0000"))
       assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 22:59:60 -0100"));t.utc
       t += 1 if t.sec == 60
       assert_equal(t, Time.rfc2822("Thu,  1 Jan 1999 00:00:00 UTC"))
-      assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:00:00 +0000"));t.localtime
+      assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:00:00 -0000"));t.localtime
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 09:00:00 +0900"))
       assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 01:00:00 +0100"))
-      assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:00:00 -0000"))
+      assert_equal(t, Time.rfc2822("Fri,  1 Jan 1999 00:00:00 +0000"))
       assert_equal(t, Time.rfc2822("Fri, 31 Dec 1998 23:00:00 -0100"))
     end
 
     def test_xmlschema_leap_second
       t = Time.utc(1998,12,31,23,59,59)
       assert_equal(t, Time.xmlschema("1998-12-31T23:59:59Z"))
-      assert_equal(t, Time.xmlschema("1998-12-31T23:59:59+00:00"));t.localtime
+      assert_equal(t, Time.xmlschema("1998-12-31T23:59:59-00:00"));t.localtime
       assert_equal(t, Time.xmlschema("1999-01-01T08:59:59+09:00"))
       assert_equal(t, Time.xmlschema("1999-01-01T00:59:59+01:00"))
-      assert_equal(t, Time.xmlschema("1998-12-31T23:59:59-00:00"))
+      assert_equal(t, Time.xmlschema("1998-12-31T23:59:59+00:00"))
       assert_equal(t, Time.xmlschema("1998-12-31T22:59:59-01:00"));t.utc
       t += 1
       assert_equal(t, Time.xmlschema("1998-12-31T23:59:60Z"))
-      assert_equal(t, Time.xmlschema("1998-12-31T23:59:60+00:00"));t.localtime
+      assert_equal(t, Time.xmlschema("1998-12-31T23:59:60-00:00"));t.localtime
       assert_equal(t, Time.xmlschema("1999-01-01T08:59:60+09:00"))
       assert_equal(t, Time.xmlschema("1999-01-01T00:59:60+01:00"))
-      assert_equal(t, Time.xmlschema("1998-12-31T23:59:60-00:00"))
+      assert_equal(t, Time.xmlschema("1998-12-31T23:59:60+00:00"))
       assert_equal(t, Time.xmlschema("1998-12-31T22:59:60-01:00"));t.utc
       t += 1 if t.sec == 60
       assert_equal(t, Time.xmlschema("1999-01-01T00:00:00Z"))
-      assert_equal(t, Time.xmlschema("1999-01-01T00:00:00+00:00"));t.localtime
+      assert_equal(t, Time.xmlschema("1999-01-01T00:00:00-00:00"));t.localtime
       assert_equal(t, Time.xmlschema("1999-01-01T09:00:00+09:00"))
       assert_equal(t, Time.xmlschema("1999-01-01T01:00:00+01:00"))
-      assert_equal(t, Time.xmlschema("1999-01-01T00:00:00-00:00"))
+      assert_equal(t, Time.xmlschema("1999-01-01T00:00:00+00:00"))
       assert_equal(t, Time.xmlschema("1998-12-31T23:00:00-01:00"))
     end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]