Matthew Moss
8/25/2008 2:45:00 PM
My own solution:
require 'date'
(now, _, dd, _, _, dhm) = `uptime`.split(/ +|,/)
(dd, dh, dm) = dd.to_i, *dhm.split(':').map { |x| x.to_i }
dh += (dm / 60.0)
dd += (dh / 24.0)
last = DateTime.parse(now) - dd
puts "Last reboot: #{last.year} #{Date::ABBR_MONTHNAMES[last.mon]}
#{last.day} at #{last.hour}:#{last.min}"