module Duration def to_duration total_secs = self / 1000.0 mins = (total_secs / 60.0).to_i secs = (total_secs - mins*60).to_i "%d:%02d" % [mins, secs] end end class Numeric; include Duration; end