Os.date() returns nil above an unknown, arbitrary number

Hello, I’m using os.date("!*t",os.time()) to set my game’s time of day. Imagine my surprise when I go to speed up the day/night cycle by cheating and multiplying os.time by 50, only to find os.date returning nil!

I was curious, so I punched this into the command line:

print(os.date("!*t",8451712348))

Wouldn’t you know it, it spat out a function. That time stamp is 218 years in the future. So far so good. So I stuck a 1 on the front of that number. 18451712348. Still works. Okay, how about 118451712348- no.

It works above the maximum unsigned 32-bit integer (4,294,967,295), but seems to halt and catch fire somewhere in between 18,451,712,348 and 118,451,712,348. Why is this? It seems arbitrary.

I tested the same using the live demo on the Lua website, and it keeps spitting out valid results even at os.time()*5000000.

Lua live demo screenshot

Recent post related to this:

You are probably not seeing it on the Lua live demo because I’m assuming its run off a Linux back-end and not Windows. (that, and/or Roblox might be using the underlying system in a different way to get the date than stock Lua does)

1 Like

Thanks - neither forum search nor the “similar topics” showed that. Good to know - will bear that in mind in future.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.