如何从 linux 时间戳中获取当前时间?我可以得到年、月、日、分和秒,但不能得到小时。有什么帮助吗?
当前代码:
local secondsPassed = os ~= nil and os.time() or tick()
local year = 1970 + math.floor(secondsPassed / (86400 * 365.25))
local days = math.floor((secondsPassed % (365.25 * 86400)) / 86400)
days = days + (year - 2011)
local minutes = math.floor((secondsPassed % 3600) / 60)
local seconds = math.floor(secondsPassed % 60)
破碎的:
local hours = math.floor((secondsPassed % 86400) / 3600)-- +1