class ProgressBar::Timer

def divide_seconds(seconds)

def divide_seconds(seconds)
  hours, seconds   = seconds.divmod(3600)
  minutes, seconds = seconds.divmod(60)
  [hours, minutes, seconds]
end

def elapsed_seconds

def elapsed_seconds
  return 0 unless started?
  ((stopped_at || time.now) - started_at)
end

def elapsed_whole_seconds

def elapsed_whole_seconds
  elapsed_seconds.floor
end

def initialize(options = {})

def initialize(options = {})
  self.time = options[:time] || ::ProgressBar::Time.new
end

def now

def now
  time.now
end

def pause

def pause
  stop
end

def reset

def reset
  self.started_at = nil
  self.stopped_at = nil
end

def reset?

def reset?
  !started_at
end

def restart

def restart
  reset
  start
end

def resume

def resume
  start
end

def start

def start
  self.started_at = stopped? ? time.now - (stopped_at - started_at) : time.now
  self.stopped_at = nil
end

def started?

def started?
  started_at
end

def stop

def stop
  return unless started?
  self.stopped_at = time.now
end

def stopped?

def stopped?
  stopped_at
end