Module:Util

local p = {} function p.d(time) if not time or time == 0 or time == '' then return '' end result = '' seconds = tonumber(time) % 60 if seconds == 1 then result = '1 second' elseif seconds ~= 0 then result = seconds .. ' seconds' end time = (time - time % 60) / 60 minutes = time % 60 if result:len and minutes ~= 0 then result = ' ' .. result end if minutes == 1 then result = '1 minute' .. result elseif minutes ~= 0 then result = minutes .. ' minutes' .. result end time = (time - time % 60) / 60 total_hours = time hours = time % 24 if result:len and hours ~= 0 then result = ' ' .. result end days = (time - time % 24) / 24 result_2 = result if total_hours == 1 then result_2 = '1 hour' .. result_2 elseif total_hours ~= 0 then result_2 = total_hours .. ' hours' .. result_2 end if hours == 1 then result = '1 hour' .. result elseif hours ~= 0 then result = hours .. ' hours' .. result end if days == 0 then return result_2 elseif days == 1 then return result_2 .. ' (' .. '1 day ' .. result .. ')' else return result_2 .. ' (' .. days .. ' days ' .. result .. ')' end end function p.fd(frame) return p.d(frame.args[1]) end function p.c(number) local result = tostring(number), k   while true do        result, k = result:gsub("^(-?%d+)(%d%d%d)", '%1,%2') if k == 0 then break end end return result end function p.fc(frame) return p.c(frame.args[1]) end function p.pp(frame) return frame:preprocess(frame.args[1]) end return p