fork download
  1. require 'time'
  2. targetTime = 3
  3.  
  4. diff = targetTime - 1; diff *= 60 #Time.now
  5. diff = diff < 0 ? 0 : diff;
  6. sT = diff % 60
  7. mT = (diff - sT)/60
  8. puts "%dm %02ds" % [mT, sT]
Success #stdin #stdout 0.06s 10160KB
stdin
Standard input is empty
stdout
2m 00s