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

ruby-changes:3595

From: ko1@a...
Date: Thu, 17 Jan 2008 21:07:20 +0900 (JST)
Subject: [ruby-changes:3595] tadf - Ruby:r15084 (ruby_1_8): * lib/date.rb (Date::Infinity#<=>): didn't work. A patch from

tadf	2008-01-17 21:07:07 +0900 (Thu, 17 Jan 2008)

  New Revision: 15084

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/date/format.rb
    branches/ruby_1_8/lib/date.rb

  Log:
    * lib/date.rb (Date::Infinity#<=>): didn't work.  A patch from
      Dirkjan Bussink <d.bussink AT gmail.com> [ruby-core:15098].
      This is a bug obviously.  However it didn't affect the library's
      functions.
    
    * lib/date.rb, lib/date/format.rb: some trivial changes.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=15084&r2=15083&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/date.rb?r1=15084&r2=15083&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/date/format.rb?r1=15084&r2=15083&diff_format=u

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 15083)
+++ ruby_1_8/ChangeLog	(revision 15084)
@@ -1,3 +1,12 @@
+Thu Jan 17 21:06:01 2008  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/date.rb (Date::Infinity#<=>): didn't work.  A patch from
+	  Dirkjan Bussink <d.bussink AT gmail.com> [ruby-core:15098].
+	  This is a bug obviously.  However it didn't affect the library's
+	  functions.
+
+	* lib/date.rb, lib/date/format.rb: some trivial changes.
+
 Tue Jan 15 15:09:28 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* win32/setup.mak: strip out empty lines from CPP output.
Index: ruby_1_8/lib/date/format.rb
===================================================================
--- ruby_1_8/lib/date/format.rb	(revision 15083)
+++ ruby_1_8/lib/date/format.rb	(revision 15084)
@@ -1,5 +1,5 @@
 # format.rb: Written by Tadayoshi Funaba 1999-2008
-# $Id: format.rb,v 2.42 2008-01-12 10:54:29+09 tadf Exp $
+# $Id: format.rb,v 2.43 2008-01-17 20:16:31+09 tadf Exp $
 
 require 'rational'
 
@@ -257,12 +257,12 @@
       when 'j'; emit_n(yday, 3, f)
       when 'k'; emit_a(hour, 2, f)
       when 'L'
-	emit_n((sec_fraction / MILLISECONDS_IN_DAY).round, 3, f)
+	emit_n((sec_fraction / MILLISECONDS_IN_DAY).floor, 3, f)
       when 'l'; emit_a((hour % 12).nonzero? || 12, 2, f)
       when 'M', 'OM'; emit_n(min, 2, f)
       when 'm', 'Om'; emit_n(mon, 2, f)
       when 'N'
-	emit_n((sec_fraction / NANOSECONDS_IN_DAY).round, 9, f)
+	emit_n((sec_fraction / NANOSECONDS_IN_DAY).floor, 9, f)
       when 'n'; "\n"
       when 'P'; emit_ad(strftime('%p').downcase, 0, f)
       when 'p'; emit_au(if hour < 12 then 'AM' else 'PM' end, 0, f)
Index: ruby_1_8/lib/date.rb
===================================================================
--- ruby_1_8/lib/date.rb	(revision 15083)
+++ ruby_1_8/lib/date.rb	(revision 15084)
@@ -6,7 +6,7 @@
 # Documentation: William Webber <william@w...>
 #
 #--
-# $Id: date.rb,v 2.36 2008-01-12 10:54:29+09 tadf Exp $
+# $Id: date.rb,v 2.37 2008-01-17 20:16:31+09 tadf Exp $
 #++
 #
 # == Overview
@@ -275,8 +275,8 @@
 
     def <=> (other)
       case other
-      when Infinity; d <=> other.d
-      when Numeric; d
+      when Infinity; return d <=> other.d
+      when Numeric; return d
       else
 	begin
 	  l, r = other.coerce(self)
@@ -524,7 +524,7 @@
 	if Integer === h && Integer === min && Integer === s
 	  Rational(h * 3600 + min * 60 + s, 86400) # 4p
 	else
-	  h.to_r/24 + min.to_r/1440 + s.to_r/86400
+	  (h * 3600 + min * 60 + s).to_r/86400 # 4p
 	end
     end
   end

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

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