How do you get time for a millisecond?

Asked

Viewed 196 times

3

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

Ex: 86400000

Would be: 24:00:00 since it is the equivalent of a day.

  • Is given 86400000 and you want to 24:00:00 or vice versa?

1 answer

3


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

  • create a C function and use the interoperability API to expose it to script Moon. An example can be found in this response in the OS.
  • use an external library that contains a function that does this. You can use the Luasocket and make socket.gettime() * 1000.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.