Module: DurationExtensions::InstanceMethods

Defined in:
lib/duration_extensions.rb

Instance Method Summary collapse

Instance Method Details

#timecodeObject Also known as: to_timecode



29
30
31
32
33
34
35
# File 'lib/duration_extensions.rb', line 29

def timecode
  return '00:00:00' if value == 0
  h = (value/3600).floor;
  m = ((value % 3600)/60).floor;
  s = value % 60;
  sprintf("%d:%02d:%02d", h, m, s)
end