Sha256: f5754b4fe4f2fcfe35db1bc5a4c692fb69dc774cc80a1aed18ff4f565d06937f

Contents?: true

Size: 353 Bytes

Versions: 2

Compression:

Stored size: 353 Bytes

Contents

require "time"

module ProconBypassMan
  class Uptime
    def self.from_boot
      result = `uptime -s`.chomp
      return -1 if result == '' # darwin系だとsオプションが使えない
      boot_time = result.to_i
      return Time.now.to_i - boot_time.to_i
    rescue => e
      ProconBypassMan.logger.error(e)
      return -1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.11 lib/procon_bypass_man/uptime.rb
procon_bypass_man-0.1.10 lib/procon_bypass_man/uptime.rb