Lua - Current time in milliseconds

后端 未结 10 952
自闭症患者
自闭症患者 2020-12-01 01:56

Is there a common way to get the current time in or with milliseconds?

There is os.time(), but it only provides full seconds.

10条回答
  •  伪装坚强ぢ
    2020-12-01 02:29

    I use LuaSocket to get more precision.

    require "socket"
    print("Milliseconds: " .. socket.gettime()*1000)
    

    This adds a dependency of course, but works fine for personal use (in benchmarking scripts for example).

提交回复
热议问题