Skip to content

Time.at argument handling #7265

@olbrich

Description

@olbrich

Environment Information

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
  • Operating system and platform (e.g. uname -a)
ruby -v
jruby 9.3.6.0 (2.6.8) 2022-06-27 7a2cbcd376 OpenJDK 64-Bit Server VM 18.0.1+10 on 18.0.1+10 +jit [arm64-darwin]
uname -a
Darwin laptop.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64

Expected Behavior

ruby 2.6.10p210 (2022-04-12 revision 67958) [arm64-darwin21]

irb(main):001:0> Time.at(12345, 500, in: '-04:00')
=> 1969-12-31 23:25:45 -0400

Actual Behavior

irb(main):001:0> Time.at(12345, 500, in: '-04:00')
Traceback (most recent call last):
       10: from /Users/---/.asdf/installs/ruby/jruby-9.3.6.0/bin/irb:23:in `<main>'
        9: from org/jruby/RubyKernel.java:1052:in `load'
        8: from /Users/---/.asdf/installs/ruby/jruby-9.3.6.0/lib/ruby/gems/shared/gems/irb-1.0.0/exe/irb:11:in `<main>'
        7: from org/jruby/RubyKernel.java:1237:in `catch'
        6: from org/jruby/RubyKernel.java:1237:in `catch'
        5: from org/jruby/RubyKernel.java:1507:in `loop'
        4: from org/jruby/RubyKernel.java:1091:in `eval'
        3: from (irb):1:in `evaluate'
        2: from org/jruby/RubyTime.java:1371:in `at'
        1: from org/jruby/RubyTime.java:1360:in `at'
ArgumentError (unexpected unit )

The default unit for this form of call is apparently microseconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions