Skip to content

Commit 68763b4

Browse files
authored
Merge pull request #144 from nobu/master
Remove archaic conditions
2 parents 8eeb28c + 2c310d9 commit 68763b4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/date/test_date_conv.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,17 @@ def test_to_time__from_datetime
8282
assert_equal([1582, 10, 13, 1, 2, 3, 456789],
8383
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.usec])
8484

85-
if Time.allocate.respond_to?(:nsec)
86-
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123.to_r/86400000000000
87-
t = d.to_time.utc
88-
assert_equal([2004, 9, 19, 1, 2, 3, 456789123],
89-
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec])
90-
end
85+
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123.to_r/86400000000000
86+
t = d.to_time.utc
87+
assert_equal([2004, 9, 19, 1, 2, 3, 456789123],
88+
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec])
9189

9290
# TruffleRuby does not support more than nanoseconds
9391
unless RUBY_ENGINE == 'truffleruby'
94-
if Time.allocate.respond_to?(:subsec)
95-
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
96-
t = d.to_time.utc
97-
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)],
98-
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec])
99-
end
92+
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
93+
t = d.to_time.utc
94+
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)],
95+
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec])
10096
end
10197
end
10298

0 commit comments

Comments
 (0)