M
Matt Mencel
Hi,
I've got a bit of code that I borrowed from here http://www.ruby-forum.com/topic/77821. I use it to convert MS timestamps into a ruby Time object.
It works fine on Mac/Linux, but not on a Solaris SPARC system. The error is "bignum too big to convert into `long'" and it occurs on the line that begins...
Time.at(.....)
I'm wondering if it's because SPARC is Big-Endian that I get the error?
def self.ad2time(timestamp)
ad_epoch = 116_444_736_000_000_000
ad_multiplier = 10_000_000
# DEBUG
ap ad_epoch.class
puts "TIMESTAMP: #{timestamp}"
ap timestamp.class
Time.at((timestamp.to_i - ad_epoch) / ad_multiplier)
end
On my Mac (Snow Leopard x86_64) the DEBUG output looks like this...
Fixnum < Integer
TIMESTAMP: 9223372036854775807
Net::BER::BerIdentifiedString < String
On Solaris SPARC it's this...
Bignum < Integer
TIMESTAMP: 9223372036854775807
String < Object
Looks like on Solaris it forces the 'ad_epoch' to a Bignum instead of a Fixnum? Should I try to cast it to a Fixnum on Solaris maybe?
Matt
I've got a bit of code that I borrowed from here http://www.ruby-forum.com/topic/77821. I use it to convert MS timestamps into a ruby Time object.
It works fine on Mac/Linux, but not on a Solaris SPARC system. The error is "bignum too big to convert into `long'" and it occurs on the line that begins...
Time.at(.....)
I'm wondering if it's because SPARC is Big-Endian that I get the error?
def self.ad2time(timestamp)
ad_epoch = 116_444_736_000_000_000
ad_multiplier = 10_000_000
# DEBUG
ap ad_epoch.class
puts "TIMESTAMP: #{timestamp}"
ap timestamp.class
Time.at((timestamp.to_i - ad_epoch) / ad_multiplier)
end
On my Mac (Snow Leopard x86_64) the DEBUG output looks like this...
Fixnum < Integer
TIMESTAMP: 9223372036854775807
Net::BER::BerIdentifiedString < String
On Solaris SPARC it's this...
Bignum < Integer
TIMESTAMP: 9223372036854775807
String < Object
Looks like on Solaris it forces the 'ad_epoch' to a Bignum instead of a Fixnum? Should I try to cast it to a Fixnum on Solaris maybe?
Matt