This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
puzzletime's profile picture

os.microtime()

Started by puzzletime, 27 June 2014 - 01:20 PM
puzzletime #1
Posted 27 June 2014 - 03:20 PM
It would be great to have a function which returns real server (or client) time in milliseconds to measure and optimise stuff. Moreover, it's easy to implement - you could just use Java's built-in System.currentTimeMillis() or something like that.

======
Oops, made a typo in the title :)/> - I meant os.microtime()
Edited on 27 June 2014 - 01:22 PM
MKlegoman357 #2
Posted 27 June 2014 - 03:49 PM
For time measures you can use a similar function to what you described called os.clock. It returns time in seconds for how long the in-game computer has been on and running.
Edited on 27 June 2014 - 01:50 PM
puzzletime #3
Posted 27 June 2014 - 04:03 PM
For time measures you can use a similar function to what you described called os.clock. It returns time in seconds for how long the in-game computer has been on and running.

Thanks a lot! I thought "in seconds" ment that it returns integer, not float values (like 17, or 324, sorry for my English if I'm saying something wrong).