Commit c1955d3d authored by Tukz's avatar Tukz

Protect T.FormatTime function from math.huge.

parent 543062ec
......@@ -3,6 +3,7 @@ local T, C, L = select(2, ...):unpack()
-- Hydra note: Since this file is going to be doing a lot of math/formatting, lets use locals for speed/cpu usage
-- This means no calling functions as methods :P ("string"):format(...) or ("string"):gsub(...) should be format("string", ...) and gsub("string", ...) etc.
local Infinity = math.huge
local reverse = string.reverse
local match = string.match
local modf = math.modf
......@@ -54,6 +55,10 @@ end
-- Format seconds to min/hour/day
T.FormatTime = function(s)
local Day, Hour, Minute = 86400, 3600, 60
if s == Infinity then
s = 0
end
if (s >= Day) then
return format("%dd", ceil(s / Day))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment