On 3/24/06, Nick Sieger <[EMAIL PROTECTED]> wrote:
On 3/24/06, Thomas E Enebo <[EMAIL PROTECTED] > wrote:
  Could time.at() be used to avoid all the extra sets?  I think they
both use seconds since Epoch.  Unless it is timezone screwy?

That would certainly simplify it if it works.  I'll try that this weekend.

Attached patch seems to do the trick.

I guess my original question was, is this too much of a backwards compatibility breaker, if there are java-based jruby scripts out there that are already used to using java Date that will now be receiving Ruby time objects?  Is the established convention to call a ruby object's "java_object" method to get the underlying java value?

I also put a ruby-to-java implementation in the patch, but I haven't been able to test it yet.  I wanted to test it with something like this, but it didn't work:

time = Time.now
cal.setTime(time)

......./Users/nsieger/Projects/jruby/src/builtin/javasupport.rb:332:in `matching_method': no method 'setTime' with arguments matching [org.jruby.RubyTime] (NameError)
    from /Users/nsieger/Projects/jruby/test/testDateConversion.rb:21:in `setTime'
    from /Users/nsieger/Projects/jruby/test/testDateConversion.rb:21

Is the auto-conversion in the other direction not quite as automatic, or is my implementation missing something?

/Nick

Attachment: JavaUtil.patch
Description: Binary data

Reply via email to