Project

General

Profile

Bug #12271 ยป time.diff

yui-knk (Kaneko Yuichiro), 04/12/2016 09:34 AM

View differences:

ext/date/date_core.c
* call-seq:
* t.to_time -> time
*
* Returns a copy of self as local mode.
* Returns self.
*/
static VALUE
time_to_time(VALUE self)
{
return f_getlocal(self);
return self;
}
/*
test/date/test_date_conv.rb
require 'date'
class TestDateConv < Test::Unit::TestCase
def with_tz(tz)
old = ENV["TZ"]
begin
ENV["TZ"] = tz
yield
ensure
ENV["TZ"] = old
end
end
def test_to_class
[Time.now, Date.today, DateTime.now].each do |o|
......
t2 = t.to_time.utc
assert_equal([2004, 9, 19, 1, 2, 3, 456789],
[t2.year, t2.mon, t2.mday, t2.hour, t2.min, t2.sec, t2.usec])
t = Time.new(2004, 9, 19, 1, 2, 3, '+03:00')
with_tz('Asia/Tokyo') do
t2 = t.to_time
assert_equal([2004, 9, 19, 1, 2, 3],
[t2.year, t2.mon, t2.mday, t2.hour, t2.min, t2.sec])
assert_equal(3 * 60 * 60, t2.gmt_offset)
end
end
def test_to_time__from_date
    (1-1/1)