summaryrefslogtreecommitdiff
path: root/app/helpers/time_helper.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-10 14:27:16 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-18 15:11:12 +0900
commit23526470ddb2a51575dd7c280b89d21bef6df619 (patch)
tree19f91de70b552273786a02143774abf8f9f408fb /app/helpers/time_helper.rb
parente409834f1b1f182f8b387bab4c4ca9f7b350f68a (diff)
downloadgitlab-ce-23526470ddb2a51575dd7c280b89d21bef6df619.tar.gz
Drop `allow_overflow` option in `TimeHelper.duration_in_numbers`
Diffstat (limited to 'app/helpers/time_helper.rb')
-rw-r--r--app/helpers/time_helper.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb
index 3e6a301b77d..719c351242c 100644
--- a/app/helpers/time_helper.rb
+++ b/app/helpers/time_helper.rb
@@ -21,17 +21,15 @@ module TimeHelper
"#{from.to_s(:short)} - #{to.to_s(:short)}"
end
- 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
+ def duration_in_numbers(duration_in_seconds)
+ 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]
+ if hours == 0
+ "%02d:%02d" % [minutes, seconds]
else
- time_format = duration_in_seconds < 1.hour ? "%M:%S" : "%H:%M:%S"
-
- Time.at(duration_in_seconds).utc.strftime(time_format)
+ "%02d:%02d:%02d" % [hours, minutes, seconds]
end
end
end