Method: CountedEach::Counter#time_format

Defined in:
lib/counted_each.rb

#time_format(seconds) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/counted_each.rb', line 45

def time_format(seconds)
  return '00:00' if seconds.infinite?
  h = (seconds/3600).floor
  m = ((seconds - (h*3600))/60).floor
  s = (seconds - (m * 60) - (h*3600)).floor
  
  "%d:%02d:%02d" % [h, m, s]
end