How to take time per millisecond?

3

I would like to take the time (HH: MM: SS) per millisecond.

Ex: 86400000

It would be: 24:00:00 since it is the equivalent of one day.

    
asked by anonymous 06.10.2014 / 16:18

1 answer

3

As far as I know, it is not possible directly on Lua. The closest you could get is to use os.clock() but accuracy is lower. However I can suggest some options:

  • Create a function in C and use the Interop API to expose it to the Lua Lua. An example can be found in this Answer in SO .
  • Use an external library that contains a function that does this. You can use LuaSocket and make socket.gettime() * 1000 .
06.10.2014 / 16:47