1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

a reaction to recent time's changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2007-12-01 11:13:32 +00:00
parent 0d4761fb1a
commit b587334b08
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,11 @@
Sat Dec 1 19:52:57 2007 Tadayoshi Funaba <tadf@dotrb.org>
* 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@atdot.net>
* bootstraptest/test_knownbug.rb: move fixed bugs.

View file

@ -6,7 +6,7 @@
# Documentation: William Webber <william@williamwebber.com>
#
#--
# $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 @@ class Time
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 @@ class DateTime < Date
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