金狮镖局 Design By www.egabc.com
lua自带的时间函数只能到秒的精度。
为了统计到毫秒精度的时间,可以使用luasocket。下载地址http://files.luaforge.net/releases/luasocket/luasocket
编译安装的时候,你可能需要在源码包根目录下的config文件中指定LUAINC变量为你的lua路径。
复制代码 代码如下:
local socket = require "socket"
local t0 = socket.gettime()
-- do something
local t1 = socket.gettime()
print("used time: "..t1-t0.."ms")
update:
如果对精度的要求不需要到毫秒级别,可以用自带的os模块.精度为0.01秒
复制代码 代码如下:
local s = os.clock()
local e = os.clock()
print("used time"..e-s.." seconds")
标签:
lua,使用毫秒精度时间
金狮镖局 Design By www.egabc.com
金狮镖局
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
金狮镖局 Design By www.egabc.com
暂无lua中使用毫秒精度时间的方法的评论...
更新日志
2024年10月09日
2024年10月09日
- s14全球总决赛瑞士轮什么时候开始 s14瑞士轮开始时间介绍
- 晨报|《使命召唤21》全球发布预告 《异形:隔离》续作官宣开发中
- 隐形女联动毁灭博士?杰西卡·阿尔巴与小唐尼晒合影
- 《博德之门3》7号补丁发布后:Mod下载量达到2200万次!
- 徐璨宾《井底的蚯蚓》[FLAC/分轨][218.37MB]
- 王冰冰《Vaga Luna 月球漫游》[320K/MP3][62.76MB]
- 证声音乐图书馆《蔚蓝海岸·爵士度假日》[320K/MP3][59.79MB]
- 群星.1993-飞图合唱歌曲精丫飞图】【WAV+CUE】
- 王霏霏.2024-TOOOOO.BUSY(EP)【SNMUSIC】【FLAC分轨】
- 张宇.2016-好男人的情歌NEWXRCD【金牌大风】【WAV+CUE】
- 《食戟之灵》小林龙胆兔女郎比基尼版模型即将发售
- 重大里程碑!九号电动第500万台智能两轮电动车正式下线
- TGA主持人发文祝贺《暗喻幻想》 国外网友:提名稳了?
- 【原神】V5.0攻略 | 旋曜玉帛收集攻略(序号81~序号90)
- 【原神】V5.0攻略 | 旋曜玉帛收集攻略(序号91~序号100)