代码:
[Lua] 纯文本查看 复制代码 local rtc_buf
local us
local Hour
local Min
local Sec
function printf(...)
print(string.format(...))
end
us = get_runtime_us()
while(1)
do
rtc_buf = read_clock()
Hour = tonumber(string.byte(rtc_buf,5,5))
Min = tonumber(string.byte(rtc_buf,6,6))
Sec = tonumber(string.byte(rtc_buf,7,7))
s_BeginRTCTime = (Hour * 3600 + Min * 60 + Sec) * 1000000
total_time = s_BeginRTCTime + check_runtime_us(us)
printf("%s:%06d", os.date("系统运行时间 = %H:%M:%S", total_time//1000000), total_time%1000000)
delayms(100)
end
|