`os.epoch()` results are not in milliseconds
ouroborus opened this issue · 6 comments
Minecraft Version
1.18.x
Version
1.100.8
Details
The CC:Tweaked docs say that "ingame"
is the default argument and that it produces the number of milliseconds since world creation. However, os.epoch()
gives values that appear to be in 1/72nds of a millisecond.
Examples:
lua> a=os.epoch(); os.sleep(0.05); b=os.epoch(); c=b-a; print(c)
3600
0.05 seconds is 50ms or one tick, so the results in the example should be near 50.
lua> a=os.epoch("utc"); os.sleep(0.05); b=os.epoch("utc"); c=b-a; print(c)
38
Typical of actual game tick timing, but close to 50ms.
can this be reproduced on 1.19 as well?
it wont matter either way but if it is reproducible on 1.19 then it would be useful to know. (same with #123 )
This is actually the intended behavior. The "ingame" epoch is in-game time. There are 72 Minecraft days in one real-world day, so there are 72 Minecraft milliseconds in one real-world millisecond! Also, note that the "ingame" epoch freezes if you disable the world's daylight cycle. The "utc" and "local" options are available if you want wall clock time.