Error: Bignum too big to convert into `long'

Ah...

9223372036854775807 is the timestamp value assigned to the "accountExpires" attribute in Active Directory when any account is set to "Never Expire".

It works fine on Linux/Mac but not on Solaris. I guess I'll just convert that timestamp to something like 12/31/2099 23:59:59 before I run the Time.at.

Matt

···

----- Original Message -----
From: "Brian Candler" <b.candler@pobox.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Tuesday, August 10, 2010 7:53:24 AM
Subject: Re: Error: Bignum too big to convert into `long'

Try your example values in irb:

irb(main):003:0> (9223372036854775807 - 116_444_736_000_000_000) /
10_000_000
=> 910692730085
irb(main):004:0> Time.at(910692730085)
RangeError: bignum too big to convert into `long'
  from (irb):4:in `at'
  from (irb):4

Time.at expects number of seconds since Jan 1, 1970.

The value you have given it is some time in the year 30,828 :slight_smile:

I suspect either your epoch or your multiplier is wrong.

B.
--
Posted via http://www.ruby-forum.com/.

Matt Mencel wrote:

Ah...

9223372036854775807 is the timestamp value assigned to the
"accountExpires" attribute in Active Directory when any account is set
to "Never Expire".

It works fine on Linux/Mac but not on Solaris. I guess I'll just
convert that timestamp to something like 12/31/2099 23:59:59 before I
run the Time.at.

The largest Time you can have in a 32-bit value is:

irb(main):001:0> Time.at(0x7fffffff)
=> Tue Jan 19 03:14:07 +0000 2038
irb(main):002:0> Time.at(0x7fffffff+1)
RangeError: bignum too big to convert into `long'
  from (irb):2:in `at'
  from (irb):2

Being Ruby, you are not constrained to using a numeric value. You could
use nil, or a symbol like :never, or a custom object which has
sufficient Time-like behaviours:

Never = Object.new
def Never.to_s; "Never"; end

···

from :0
--
Posted via http://www.ruby-forum.com/\.