Speaking of optimization: what is a good precise way to measure the time in Codea?

os.time seems to return time in seconds since the Unix epoch, it seems, but stored in a float. The precision of the float mantissa isn’t enough, so os.difftime returns zero for small intervals.

os.clock returns weird things - at least they increase monotonically.

It would be nice to have a function that returns precise milliseconds since the start of the game (not the start of Codea).

There is ElapsedTime and DeltaTime (global variables). But they are only updated every draw() call — so can’t be used for intra-frame measurements. I’ll think about adding a CurrentElapsedTime() function or similar.

that would be very neat :slight_smile: