Skip to content

Commit 63002e9

Browse files
committed
Use x.round instead of (x + 0.5).to_i
1 parent 59d50b4 commit 63002e9

File tree

1 file changed

+1
-1
lines changed
  • src/main/ruby/truffleruby/core

1 file changed

+1
-1
lines changed

src/main/ruby/truffleruby/core/time.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def at(sec, sub_sec=undefined, unit=undefined, **kwargs)
341341

342342
seconds, sec_frac = sec.divmod(1)
343343

344-
nsec = (sec_frac * 1_000_000_000 + 0.5).to_i + (sub_sec * sub_sec_scale).to_i
344+
nsec = (sec_frac * 1_000_000_000).round + (sub_sec * sub_sec_scale).to_i
345345

346346
seconds += nsec / 1_000_000_000
347347
nsec %= 1_000_000_000

0 commit comments

Comments
 (0)