diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-19 17:42:26 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-19 17:42:26 +0000 |
commit | eae636edb4f01c7f8902856ca95fce7c8453a541 (patch) | |
tree | 1ff705c222b5ed6974e7cd4e3e15eb81041d9386 /app/helpers | |
parent | 66eb01853a15cf517341e91fdd10f6384fec80de (diff) | |
parent | c627dbc8fbf6f759dc9b40d75fa6fc9a435a461f (diff) | |
download | gitlab-ce-eae636edb4f01c7f8902856ca95fce7c8453a541.tar.gz |
Merge branch 'wall-clock-time-for-showing-pipeline' into 'master'
Show wall-clock time when showing pipeline
## What does this MR do?
Show wall-clock time when showing pipeline instead of cumulative builds time.
Closes #17007
See merge request !5734
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/time_helper.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb index 790001222f1..271e839692a 100644 --- a/app/helpers/time_helper.rb +++ b/app/helpers/time_helper.rb @@ -15,20 +15,9 @@ module TimeHelper "#{from.to_s(:short)} - #{to.to_s(:short)}" end - def duration_in_numbers(finished_at, started_at) - interval = interval_in_seconds(started_at, finished_at) - time_format = interval < 1.hour ? "%M:%S" : "%H:%M:%S" + def duration_in_numbers(duration) + time_format = duration < 1.hour ? "%M:%S" : "%H:%M:%S" - Time.at(interval).utc.strftime(time_format) - end - - private - - def interval_in_seconds(started_at, finished_at = nil) - if started_at && finished_at - finished_at.to_i - started_at.to_i - elsif started_at - Time.now.to_i - started_at.to_i - end + Time.at(duration).utc.strftime(time_format) end end |