summaryrefslogtreecommitdiffstats
path: root/lib/facter/uptime_seconds.rb
blob: 9793e4161082f51f846a219300ec8fdfd7f171bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Fact: uptime_seconds
#
# Purpose: Return purely number of seconds of uptime.
#
# Resolution:
#   Using the 'facter/util/uptime.rb' module, try a verity of methods to acquire
#   the uptime on Unix.
#
#   On Windows, the module calculates the uptime by the "LastBootupTime" Windows
#   management value.
#
# Caveats:
#

require 'facter/util/uptime'

Facter.add(:uptime_seconds) do
  setcode { Facter::Util::Uptime.get_uptime_seconds_unix }
end

Facter.add(:uptime_seconds) do
  confine :kernel => :windows
  setcode { Facter::Util::Uptime.get_uptime_seconds_win }
end