module Console::Clock
Public Class Methods
formatted_duration(duration)
click to toggle source
# File lib/console/clock.rb, line 23 def self.formatted_duration(duration) if duration < 60.0 return "#{duration.round(2)}s" end duration /= 60.0 if duration < 60.0 return "#{duration.round}m" end duration /= 60.0 if duration < 60.0 return "#{duration.round(1)}h" end duration /= 24.0 return "#{duration.round(1)}d" end
now()
click to toggle source
Get the current elapsed monotonic time.
# File lib/console/clock.rb, line 46 def self.now ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) end