如何确定在使用Lua脚本的执行时间
答案:1 悬赏:0
解决时间 2021-02-17 14:38
- 提问者网友:藍了天白赴美
- 2021-02-17 02:53
如何确定在使用Lua脚本的执行时间
最佳答案
- 二级知识专家网友:平生事
- 2021-02-17 04:00
参考方法如下:
local str1 = "12:36:28"
local str2 = "14:38:45"
local h1,m1,s1 = string.match(str1,"(%d+):(%d+):(%d+)")
local h2,m2,s2 = string.match(str2,"(%d+):(%d+):(%d+)")
local time1 = h1 * 3600 + m1 * 60 + s1
local time2 = h2 * 3600 + m2 * 60 + s2
print(time2 - time1)
得出的是 相差多少秒 除3600就是多少小时啦
local str1 = "12:36:28"
local str2 = "14:38:45"
local h1,m1,s1 = string.match(str1,"(%d+):(%d+):(%d+)")
local h2,m2,s2 = string.match(str2,"(%d+):(%d+):(%d+)")
local time1 = h1 * 3600 + m1 * 60 + s1
local time2 = h2 * 3600 + m2 * 60 + s2
print(time2 - time1)
得出的是 相差多少秒 除3600就是多少小时啦
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯