summaryrefslogtreecommitdiffstats
path: root/lib/facter/uptime_hours.rb
blob: d02ac3201b017e62f13cbac4de6afad1c1f18e8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Fact: uptime_hours
#
# Purpose: Return purely number of hours of uptime.
#
# Resolution: Divides uptime_seconds fact by 3600.
#
# Caveats:
#

Facter.add(:uptime_hours) do
  setcode do
    seconds = Facter.value(:uptime_seconds)
    seconds && seconds / (60 * 60) # seconds in hour
  end
end