summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/plugins/uptime.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ohai/plugins/uptime.rb b/lib/ohai/plugins/uptime.rb
index c1cc5be5..d8ffbdf9 100644
--- a/lib/ohai/plugins/uptime.rb
+++ b/lib/ohai/plugins/uptime.rb
@@ -96,7 +96,8 @@ Ohai.plugin(:Uptime) do
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