And my try at this:
coeff = [60,3600]; i = 0; offset = 0
s = %x{uptime}
coeff.push 86400 if s =~ /day/
s.scan(/\d+/) do #I don't know how to stop scanning when I've had
enough ^^;;
|text|
i = i + 1
offset = offset + text.to_i*(coeff.pop||0) if (3..5) === i
end
puts (Time.now - offset).strftime("System booted at %H:%M of %A, %B %d
(%Y)")
(I don't know anything about regexp, and it shows)
--
Posted via http://www.ruby-forum.com/.