mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
* ext/date/date_core.c (datetime_to_time): preserve timezone info
[Bug #12189] [Fix GH-1295] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f8e79c84a9
commit
5f11a6eb6c
3 changed files with 15 additions and 9 deletions
|
@ -32,12 +32,10 @@ class TestDateConv < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_to_time__from_datetime
|
||||
d = DateTime.new(2004, 9, 19, 1, 2, 3, 9.to_r/24) + 456789.to_r/86400000000
|
||||
d = DateTime.new(2004, 9, 19, 1, 2, 3, 8.to_r/24) + 456789.to_r/86400000000
|
||||
t = d.to_time
|
||||
if t.utc_offset == 9*60*60
|
||||
assert_equal([2004, 9, 19, 1, 2, 3, 456789],
|
||||
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.usec])
|
||||
end
|
||||
assert_equal([2004, 9, 19, 1, 2, 3, 456789, 8*60*60],
|
||||
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.usec, t.utc_offset])
|
||||
|
||||
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789.to_r/86400000000
|
||||
t = d.to_time.utc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue