module ASFTime

This addon must be required before use

Public Class Methods

secs2text(secs) click to toggle source

Convert seconds to number of days, hours or minutes Intended for countdown-style displays

# File lib/whimsy/asf/time-utils.rb, line 8
def self.secs2text(secs)
  m = secs / 60
  s = secs - m*60
  h = m / 60
  m = m - h*60
  d = h / 24
  h = h - d*24
  return "#{d} days" if d > 0
  return "#{h} hours" if h > 0
  return "#{m} minutes"
end