Module: Lono::Utils::PrettyTime

Included in:
Script::Upload, Sets::TimeSpent
Defined in:
lib/lono/utils/pretty_time.rb

Instance Method Summary collapse

Instance Method Details

#pretty_time(total_seconds) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/lono/utils/pretty_time.rb', line 4

def pretty_time(total_seconds)
  minutes = (total_seconds / 60) % 60
  seconds = total_seconds % 60
  if total_seconds < 60
    "#{seconds.to_i}s"
  else
    "#{minutes.to_i}m #{seconds.to_i}s"
  end
end