Skip to content

Commit

Permalink
Changed WMI class from which to retrieve the system uptime for ohai u…
Browse files Browse the repository at this point in the history
…ptime plugin.
  • Loading branch information
aliasgar16 committed Sep 8, 2016
1 parent 13485c1 commit 9e1d36e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ohai/plugins/uptime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def collect_uptime(path)
collect_data(:windows) do
require "wmi-lite/wmi"
wmi = WmiLite::Wmi.new
uptime_seconds wmi.first_of("Win32_PerfFormattedData_PerfOS_System")["systemuptime"].to_i
last_boot_up_time = wmi.first_of("Win32_OperatingSystem")["lastbootuptime"]
uptime_seconds Time.new.to_i - Time.parse(last_boot_up_time).to_i
uptime seconds_to_human(uptime_seconds)
end

Expand Down

0 comments on commit 9e1d36e

Please sign in to comment.