# File lib/windows/sys/uptime.rb, line 25 def self.boot_time(host = Socket.gethostname) cs = "winmgmts://#{host}/root/cimv2" begin wmi = WIN32OLE.connect(cs) rescue WIN32OLERuntimeError => e raise Error, e else query = "select LastBootupTime from Win32_OperatingSystem" results = wmi.ExecQuery(query) results.each{ |ole| time_array = parse_ms_date(ole.LastBootupTime) return Time.mktime(*time_array) } end end