algo = {}

function algo.getSignificantTimeType(time)
	if time > 60*60*24*30*365 then
		return "y"
	elseif time > 60*60*24*30 then
		return "m"
	elseif time > 60*60*24 then
		return "d"
	elseif time > 60*60 then
		return "h"
	elseif time > 60 then
		return "m"
	else
		return "s"
	end
end

function algo.getSignificantTime(time)
	if time > 60*60*24*30*365 then
		return string.format("%.1f", time/(60*60*24*30*365))
	elseif time > 60*60*24*30 then
		return string.format("%.1f", time/(60*60*24*30))
	elseif time > 60*60*24 then
		return string.format("%.1f", time/(60*60*24))
	elseif time > 60*60 then
		return string.format("%.1f", time/(60*60))
	elseif time > 60 then
		return string.format("%.1f", time/(60))
	else
		return string.format("%.0f", time)
	end
end