Drop `allow_overflow` option in `TimeHelper.duration_in_numbers`
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21767, we introduced allow_overflow
option for TimeHelper.duration_in_numbers
method. This is for avoiding to affect other users of duration_in_numbers
such as duration_in_numbers(job.duration)
, but ideally we should fixe all duration formats, as the old seems broken.
def duration_in_numbers(duration_in_seconds, allow_overflow = false)
if allow_overflow
seconds = duration_in_seconds % 1.minute
minutes = (duration_in_seconds / 1.minute) % (1.hour / 1.minute)
hours = duration_in_seconds / 1.hour
"%02d:%02d:%02d" % [hours, minutes, seconds]
else
time_format = duration_in_seconds < 1.hour ? "%M:%S" : "%H:%M:%S"
Time.at(duration_in_seconds).utc.strftime(time_format)
end
end