This commit is contained in:
2025-01-20 16:33:10 +09:00
parent f21586192d
commit f95f5faad9

View File

@@ -265,15 +265,14 @@ end
--- @param units Common.format_time_param_units A table selecting which units should be displayed, options are: days, hours, minutes, seconds --- @param units Common.format_time_param_units A table selecting which units should be displayed, options are: days, hours, minutes, seconds
--- @return Common.extract_time_units_return --- @return Common.extract_time_units_return
function ExpUtil.extract_time_units(ticks, units) function ExpUtil.extract_time_units(ticks, units)
ticks = ticks or 0
-- Calculate the values to be determine the display values -- Calculate the values to be determine the display values
local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60 local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60
local rtn = { local rtn = {
day = floor(max_days), day = floor(max_days) or 0,
hours = floor(max_hours - floor(max_days) * 24), hours = floor(max_hours - floor(max_days) * 24) or 0,
minutes = floor(max_minutes - floor(max_hours) * 60), minutes = floor(max_minutes - floor(max_hours) * 60) or 0,
seconds = floor(max_seconds - floor(max_minutes) * 60), seconds = floor(max_seconds - floor(max_minutes) * 60) or 0,
} }
-- Remove units that are not requested -- Remove units that are not requested