Module:Time:修订间差异

此后如竟没有炬火,我便是唯一的光。
跳转到导航 跳转到搜索
无编辑摘要
无编辑摘要
第28行: 第28行:
local dayint = math.floor(days)
local dayint = math.floor(days)
local dayfroms = dayint + 1706817
local dayfroms = dayint + 1706817
local phase = (-dayfroms) % (7^8)
local phase = (-dayfroms) % (49*49*49*49)
local d = phase % 49
local d = phase % 49
local s = math.floor(phase/(47^2)+0.125) % 49
local s = math.floor(phase/(49)+0.125) % 49
local t = math.floor(phase/(47^4)+0.125) % 49
local t = math.floor(phase/(49*49)+0.125) % 49
local p = math.floor(phase/(47^6)+0.125)
local p = math.floor(phase/(49*49*49)+0.125)
if (display==1) then
if (display==1) then
return sun49(d).."日"
return sun49(d).."日"

2021年9月8日 (三) 12:45的版本

可在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