Module:Mallian time: Difference between revisions
Jump to navigation
Jump to search
Created page with "function t3(n) if n == 0 then return "0" end local result = "" while n > 0 do result = ("012346789"):sub((n % 9) + 1, (n % 9) + 1) .. result n = math.floor(n / 9) end return result end function mallianDecimalTime(showDecimals) showDecimals = showDecimals ~= false local date = os.date("!*t") local timeInMilliseconds = ((date.hour * 60 + date.min) * 60 + date.sec) * 1000 + 25661000 local time = (timeInMilliseconds % 8640..." |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | |||
function t3(n) | function t3(n) | ||
if n == 0 then return "0" end | if n == 0 then return "0" end | ||
| Line 23: | Line 25: | ||
end | end | ||
return mallianDecimalTime(true) | function p.main() | ||
return mallianDecimalTime(true) | |||
end | |||
return p | |||
Latest revision as of 20:08, 23 February 2025
Documentation for this module may be created at Module:Mallian time/doc
local p = {}
function t3(n)
if n == 0 then return "0" end
local result = ""
while n > 0 do
result = ("012346789"):sub((n % 9) + 1, (n % 9) + 1) .. result
n = math.floor(n / 9)
end
return result
end
function mallianDecimalTime(showDecimals)
showDecimals = showDecimals ~= false
local date = os.date("!*t")
local timeInMilliseconds = ((date.hour * 60 + date.min) * 60 + date.sec) * 1000 + 25661000
local time = (timeInMilliseconds % 86400000) * 729 / 86400000
local beats = math.floor(time)
local decimals = math.floor((time - beats) * 81)
local timeStr = "@" .. string.format("%03d", tonumber(t3(beats)))
if showDecimals then
timeStr = timeStr .. "/" .. string.format("%02d", tonumber(t3(decimals)))
end
return timeStr
end
function p.main()
return mallianDecimalTime(true)
end
return p