I’ve been doing a few quick tests regarding the DateTime object since apparently I’m so slow that I only found out two days ago that it’s live on the client and ready for production use. Namely my latest test was just to check if the standard constructor was functionally similar to os.time.
print(DateTime.now())
print(os.time())
Surely enough, as expected, both of these return the time since the Unix Epoch in UTC for both peers. I do notice, however, that DateTime carries at least 3 extra numbers (not decimals) in comparison to os.time which is… weird. If they’re both returning seconds, then you would expect that the numbers should be relatively the same. Three extra digits is pretty significant.
I think the best way to ask my question would be: is DateTime working with milliseconds or seconds? If DateTime.now is returning three extra digits than what os.time returns and considering the millisecond to second conversion, it would make sense, but I’d rather have concrete information over best-guess assumptions.
Here are some numbers I got during a test session grouped by the method of time retrieval if you need them for reference in regards to what I’m talking about:
[ServerScriptService.Script DateTime] 1607418376176
[ReplicatedFirst.LocalScript DateTime] 1607418377267
Difference > 1091 seconds (?)
[ServerScriptService.Script os.time] 1607418376
[ReplicatedFirst.LocalScript os.time] 1607418377
Difference > 1 second
I’ve already checked documentation and it’s not explicitly clear what the resolution of time is, so to begin with I don’t even know if DateTime.now is returning seconds. I am simply making that assumption because of the similarity of the numbers.