跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
社群首页
帮助
希顶相关网站
希顶社区官网
(原作)希顶翻译器
〇改希顶转写器
希顶模组服务器
搜索
搜索
外观
创建账号
登录
个人工具
创建账号
登录
查看“︁Module:Time”︁的源代码
模块
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
外观
移至侧栏
隐藏
←
Module:Time
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于这些用户组的用户执行:
用户
、storagereadable
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
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 -- 为方便起见,这里事实上是用数值 6 5 4 3 2 1 0 指代火木光土风水空。 function sunColor(inp) -- 太阳易双色显示 local rainbow = {"#f4592d", "#eda667", "#faf03e", "#5fb319", "#8eede2", "#0568e3","#49207c"} -- 七元素的色号,赤橙黄绿青蓝紫 local l = inp % 7 -- 下卦 local u = math.floor(inp/7+0.125) % 7 -- 上卦 return '<span style="background:-webkit-linear-gradient(90deg, '..rainbow[7-l]..' 0%, '..rainbow[7-l]..' 50%, '..rainbow[7-u]..' 50%, '..rainbow[7-u]..' 100%)"> </span>' end function sun49(inp) local gua = {"火", "祭祀", "对手", "成败", "反叛", "救赎", "爆发", "欲望", "木", "创造", "新生", "凋谢", "重生", "弥散", "自我", "寻找", "存在", "经典", "革新", "梦幻", "倾听", "忍耐", "腐朽", "绝笔", "地", "孤独", "小人", "永恒", "恶魔", "盛开", "理解", "泥土", "风", "雾气", "神", "对抗", "绽放", "思考", "同伴", "变幻", "水", "隐退", "超越", "生命", "表达", "破碎", "时间", "朦胧", "自然"} return gua[49-(inp%49)] end function module.nowDuaenn(frame) local args = getArgs(frame) local display = args[1] -- 显示模式 local offset = args[2] -- 时间偏移,单位为秒 if (offset == nil) then offset = 0 else offset = tonumber(offset) end local now = os.time() local start = os.time({year=1996,month=1,day=28,hour=0}) now = now - start if (offset ~= nil) then now = now + offset end local clock = now % 86400 - 43200 -- 一天中的时间,单位为秒,正午为零点 local duaenn = clock / 400 -- 转化为段 local duint = math.floor(duaenn) -- 段的整数部分 local suennz = (clock - 400 * duint) / 20 -- 舛 local sint = math.floor(suennz) -- 舛的整数部分 local mint = math.floor(clock % 20) -- 秒 local kc = ''; if (string.find(display,'k')~=nil) then kc=' '; end -- 空格与否 if (display==nil) then return duint else if (string.find(display,":")~=nil) then if (string.find(display,"m")~=nil) then return string.format("%+04d%s:%s%02d%s:%s%02d",duint,kc,kc,sint,kc,kc,mint) else return string.format("%+04d%s:%s%02d",duint,kc,kc,sint) end else if (string.find(display,"m")~=nil) then return string.format("%+d%s段%s%02d%s舛%s%02d%s秒",duint,kc,kc,sint,kc,kc,mint,kc) else if (string.find(display,"s")~=nil) then return string.format("%+d%s段%s%02d%s舛",duint,kc,kc,sint,kc) else return string.format("%+d%s段",duint,kc) end end end end end function module.nowSunDay(frame) local args = getArgs(frame) local display = args[1] -- 显示长度 local color = string.lower(tostring(args[2])) -- 是否显示颜色 local offset = args[3] -- 时间偏移,单位为天 if (offset == nil) then offset = 0 else offset = tonumber(offset) end local now = os.time() if (offset ~= nil) then now = now + offset * 86400 end local start = os.time({year=1996,month=1,day=28,hour=0}) -- 以公历1996年1月28日零时开始算 local days = (now-start) / 86400 local dayint = math.floor(days) local dayfroms = dayint + 1706817 -- 事实上1996年1月28日是太阳易纪元第1,706,817天 local phase = (-dayfroms) % (49*49*49*49) local d = phase % 49 -- 日 local s = math.floor(phase/(49)+0.00000000001) % 49 -- 季 local t = math.floor(phase/(49*49)+0.00000000001) % 49 -- 轮 local p = math.floor(phase/(49*49*49)+0.0000000000001) -- 朝 local dc = "" local sc = "" local tc = "" local pc = "" -- 如果显示颜色 if (color == "true") then dc = sunColor(d) sc = sunColor(s) tc = sunColor(t) pc = sunColor(p) end if (display=='1') then return dc..sun49(d).."日" else if (display=='2') then return sc..sun49(s).."季 "..dc..sun49(d).."日" else if (display=='3') then return tc..sun49(t).."轮 "..sc..sun49(s).."季 "..dc..sun49(d).."日" else return pc..sun49(p).."朝 "..tc..sun49(t).."轮 "..sc..sun49(s).."季 "..dc..sun49(d).."日" end end end end function module.latinTime(frame) local args = getArgs(frame) local offset = args[1] -- 时间偏移,单位为时 local month = {"Jeneiro", "Fabruario", "Marco", "Abrile", "Maio", "Jugno", "Julio", "Agosto", "Setembre", "Oktubre", "Novembre", "Decembre"} -- 1至12月 local weekday = {"Lunde", "Marde", "Merkrede", "Jeude", "Vendrede", "Sabado", "Domingo"} -- 周一至周日 local now = os.time() - 3600 * 8 if (offset ~= nil) then if (tonumber(offset)~=nil) then now = now + offset * 3600 end end return os.date("%X\n",now)..weekday[7-((7-tonumber(os.date("%w",now)))%7)]..os.date(", %d ",now)..month[tonumber(os.date("%m",now))]..os.date(" %Y",now) end return module
该页面使用的模板:
Module:Time/doc
(
查看源代码
)
返回
Module:Time
。