6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bosh/director/duration.rb', line 6
def duration(delta)
seconds = delta % 60
delta = (delta / 60).floor
minutes = delta % 60
delta = (delta / 60).floor
hours = delta % 24
delta = (delta / 24).floor
days = delta
result = []
duration_helper(days, result, "day")
duration_helper(hours, result, "hour")
duration_helper(minutes, result, "minute")
duration_helper(seconds, result, "second")
result << "0 seconds" if result.empty?
result.join(" ")
end
|