Method: Gren::Util.time_s
- Defined in:
- lib/milkode/common/util.rb
.time_s(time) ⇒ Object
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/milkode/common/util.rb', line 344 def time_s(time) t = time.truncate h = t / 3600 t = t % 3600 m = t / 60 t = t % 60 t += round(time - time.to_i, 2) if (h > 0 && m > 0) "#{h}h #{m}m #{t}s" elsif (m > 0) "#{m}m #{t}s" else "#{t}sec" end end |