Module:Time
外观
此模块的文档可以在Module:Time/doc创建
local module = {}
local getArgs = require('Module:Arguments').getArgs
function module.test()
local now=os.time()
local start=os.time({year=2021,month=9,day=1,hour=3})
local days=(now-start)/86400
local dayint=math.floor(days)
local hours=((now-start)%86400)/3600
return dayint..'天'..hours..'小时'
end
function module.directly()
return os.date('%p')..' '..os.date('%c')
end
function sun49(inp)
local gua = {"火", "祭祀", "对手", "成败", "反叛", "救赎", "爆发", "欲望", "木", "创造", "新生", "凋谢", "重生", "弥散", "自我", "寻找", "存在", "经典", "革新", "梦幻", "倾听", "忍耐", "腐朽", "绝笔", "地", "孤独", "小人", "永恒", "恶魔", "盛开", "理解", "泥土", "风", "雾气", "神", "对抗", "绽放", "思考", "同伴", "变幻", "水", "隐退", "超越", "生命", "表达", "破碎", "时间", "朦胧", "自然"}
return gua[49-(inp%49)]
end
function module.nowSunDay(frame)
local args = getArgs(frame)
local display = args[1]
local now = os.time()
local start = os.time({year=1996,month=1,day=28,hour=0})
local days = (now-start) / 86400
local dayint = math.floor(days)
local dayfroms = dayint + 1706817
local phase = (-dayfroms) % (49*49*49*49)
local d = phase % 49
local s = math.floor(phase/(49)+0.125) % 49
local t = math.floor(phase/(49*49)+0.125) % 49
local p = math.floor(phase/(49*49*49)+0.125)
if (display=='1') then
return sun49(d).."日"
else
if (display=='2') then
return sun49(s).."季 "..sun49(d).."日"
else
if (display=='3') then
return sun49(t).."轮 "..sun49(s).."季 "..sun49(d).."日"
else
return sun49(p).."朝 "..sun49(t).."轮 "..sun49(s).."季 "..sun49(d).."日"
end
end
end
end
return module