Modul:TwitterSnowflake: Unterschied zwischen den Versionen
keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 4: | Zeile 4: | ||
format = format or "!%c" | format = format or "!%c" | ||
epoch = epoch or 1288834974 | epoch = epoch or 1288834974 | ||
if type(id_str) ~= "string" then error("bad argument #1 (expected string, got " .. type(id_str) .. ")", 2) end | if type(id_str) ~= "string" then error("bad argument #1 (expected string, got " .. type(id_str) .. ")", 2) end | ||
if type(format) ~= "string" then error("bad argument #2 (expected string, got " .. type(format) .. ")", 2) end | if type(format) ~= "string" then error("bad argument #2 (expected string, got " .. type(format) .. ")", 2) end | ||
Zeile 18: | Zeile 17: | ||
end | end | ||
local timestamp = math.floor((hi * 1024 + math.floor(lo / 4194304)) / 1000) + epoch | local timestamp = math.floor((hi * 1024 + math.floor(lo / 4194304)) / 1000) + epoch | ||
return | return os.date(format, timestamp) | ||
end | end |