Class: Tlog::Format::Seconds
- Inherits:
-
Object
- Object
- Tlog::Format::Seconds
- Defined in:
- lib/tlog/format/seconds.rb
Class Method Summary collapse
Class Method Details
.duration(total_seconds) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/tlog/format/seconds.rb', line 3 def self.duration(total_seconds) output = "" total_seconds ||= 0 total_seconds = total_seconds.to_i mm, ss = total_seconds.divmod(60) hh, mm = mm.divmod(60) output = "%2s:%02d:%02d" % [hh, mm, ss] return output end |