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

ruby-changes:2576

From: ko1@a...
Date: 1 Dec 2007 20:14:01 +0900
Subject: [ruby-changes:2576] tadf - Ruby:r14067 (trunk): a reaction to recent time's changes.

tadf	2007-12-01 20:13:32 +0900 (Sat, 01 Dec 2007)

  New Revision: 14067

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

  Log:
    a reaction to recent time's changes.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/date.rb?r1=14067&r2=14066
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14067&r2=14066

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14066)
+++ ChangeLog	(revision 14067)
@@ -1,3 +1,11 @@
+Sat Dec  1 19:52:57 2007  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/date.rb (Time#to_datetime): use nsec instead of usec.
+
+	* lib/date.rb (DateTime#to_time): second minute as an argument to
+	  Time::utc contains fractional part in rational; hence Time
+	  object may keep resolution at most nanosecond.
+
 Sat Dec  1 14:36:05 2007  Koichi Sasada  <ko1@a...>
 
 	* bootstraptest/test_knownbug.rb: move fixed bugs.
Index: lib/date.rb
===================================================================
--- lib/date.rb	(revision 14066)
+++ lib/date.rb	(revision 14067)
@@ -6,7 +6,7 @@
 # Documentation: William Webber <william@w...>
 #
 #--
-# $Id: date.rb,v 2.31 2007-09-08 08:30:25+09 tadf Exp $
+# $Id: date.rb,v 2.32 2007-12-01 18:51:16+09 tadf Exp $
 #++
 #
 # == Overview
@@ -1734,7 +1734,7 @@
   def to_datetime
     jd = DateTime.__send__(:civil_to_jd, year, mon, mday, DateTime::ITALY)
     fr = DateTime.__send__(:time_to_day_fraction, hour, min, [sec, 59].min) +
-	 usec.to_r/86400_000_000
+      nsec.to_r/86400_000_000_000
     of = utc_offset.to_r/86400
     DateTime.new!(DateTime.__send__(:jd_to_ajd, jd, fr, of),
 		  of, DateTime::ITALY)
@@ -1767,8 +1767,8 @@
   def to_time
     d = new_offset(0)
     d.instance_eval do
-      Time.utc(year, mon, mday, hour, min, sec,
-	       (sec_fraction * 1_000_000).to_i)
+      Time.utc(year, mon, mday, hour, min, sec +
+	       sec_fraction)
     end.
 	getlocal
   end

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

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