Best way store total seconds?

Hello all,

Since total seconds appears larger than a 32bit integer, what it the best data type to use in these cases?



Thanks Julian.

I always wondered about that double.

32bit Integer: up to 2,147,483,647 ≈ 68 years

32bit unsigned Integer: up to 4,294,967,295 ≈ 136 years

64bit Integer: up to 9,223,372,036,854,775,807 ≈ 292 BILLION years

64bit unsigned Integer: up to 18,446,744,073,709,551,615 ≈ 584 BILLION years

Now clearly 32bit Integers are too small to hold the TotalNumberOfSeconds since 1904, and unsigned 32bit Integers are getting uncomfortably close, but why not 64bit Integers? After all 64bit Integers are available on 32bit systems, and TotalSeconds since 1904 is clearly a whole number.

The sun is about 5 Billion years old and will shine for about another 5 Billion before turning into a Red Giant.

The age of the Universe is 13.8 Billion Years.

So what length of time in seconds do people want to store?

1 Like

I have a feeling that 64 bit integers didn’t exist in RB at that time which is why a double was used.


Just use a double and stop worrying about it. Near as I can figure, that gives you an exact number of seconds for the next 136 million years.

That’s way too short.


Oh, splllllltth, which I understand may be politely rendered as <raspberry>. I think that settles the matter.