Modul:TwitterSnowflake: Unterschied zwischen den Versionen
Undid revision 1001179022 by Elliot321 (talk)
(copy from sandbox (all testcases match)) |
|||
Zeile 13: | Zeile 13: | ||
local hiexp = 1 | local hiexp = 1 | ||
for c in id_str:gmatch(".") do | for c in id_str:gmatch(".") do | ||
lo = lo * 10 + c | lo = lo * 10 + tostring(c) | ||
if lo >= 2^32 then | if lo >= 2^32 then | ||
hi, lo = hi * 10^hiexp + math.floor(lo / 2^32), lo % 2^32 | hi, lo = hi * 10^hiexp + math.floor(lo / 2^32), lo % 2^32 | ||
Zeile 26: | Zeile 26: | ||
function p.getDate(frame) | function p.getDate(frame) | ||
-- just pass frame directly to snowflakeToDate, this wraps it but the args are the same plus | -- just pass frame directly to snowflakeToDate, this wraps it but the args are the same plus | ||
frame.args.format = "%B %e, %Y" | frame.args.format = "%B %e, %Y" | ||
frame.args.epoch = tonumber(frame.args.epoch) or 1288834974 | frame.args.epoch = tonumber(frame.args.epoch) or 1288834974 | ||
Zeile 36: | Zeile 33: | ||
return -1 | return -1 | ||
end | end | ||
return Date(frame.args.date) - twitterdate | |||
end | end | ||
return p | return p |