Here is an update on what is going on with the NSDate issues.
i have been working with 3 version's of MacRuby.
MacRuby 0.7 with Vincent's first suggested modification (commenting out the
NSDate clause in objc.m (This
essentially makes MacRuby use a real NSDate object instead of converting it
into a Ruby Time object)
MacRuby 0.8 with no changes
MacRuby 0.9 with Vincent's NSDate changes. (He fixes the NSDate/Ruby Time
object)
The test code:
NSLog( "In rb_main.rb")
i = 1296445544
NSLog( "i = %d class = %s" % [i, i.class.to_s])
f = 1296445544.0
NSLog( "f = %f class = %@ DIG = %d" % [ f, f.class, Float::DIG.to_s])
if i == f
NSLog( "Is equal")
else
NSLog( "Not equal")
end
time = Time.new
NSLog( "time = %s" % [time.to_s])
NSLog( "time to_i = %d" % [time.to_i])
NSLog( "time to_f = %f" % [time.to_f])
nsdate = NSDate.date
NSLog( "nsdate = %s" % [nsdate.description])
i = nsdate.timeIntervalSinceReferenceDate.to_i
f = nsdate.timeIntervalSinceReferenceDate.to_f
NSLog( "nsdate to_i = %d" % [i])
NSLog( "nsdate to_f = %f" % [f])
Summary (all tests were run in 32 bit mode): I can provide the output if you
wish to see it.
MacRuby 0.7
- NSDate is fixed, Can also do calculations with the date like adding 60
seconds,etc.
- Ruby Time - date is correct, to_i is correct, to_f is incorrect
- Bignum.to_i is correct, Bignum.to_f is wrong
MacRuby 0.8
- NSDate is broken - wrong time, wrong to_i, wrong to_f
- Ruby Time - date is correct, to_i is correct, to_f is incorrect
- Bignum.to_i is correct, Bignum.to_f is wrong
MacRuby 0.9
- NSDate is somewhat fixed. It returns the correct time, but fails when doing
calculations with that date
- Ruby Time - date is correct, to_i is correct, to_f is incorrect
- Bignum.to_i is correct, Bignum.to_f is wrong
My conclusions,
- 0.7 and 0.9 fix return the correct time now, 0.9 fix can't do necessary time
arithmetic
- Ruby Time.to_f is broken in all 3 versions
- Bignum.to_f is broken in all 3 versions
- I believe the to_f method is behind all of these problems but i haven't had
time to find the problem nor
a solution.
* Late breaking news, I was running my real app with the modified 0.7 version
and when i attempted
to 'play' an NSSound, the application exited with a return code 45?? I am not
sure what this means.
I will try to create a test case for this later on.
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel