[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

off topic: uptime question



#+BEGIN_SRC ruby
require "date"

uptime_data = IO.read('/proc/uptime').split[0].to_i
sboot = Time.now - uptime_data

if uptime_data >= 86400
	uptime = Time.at(uptime_data).utc.strftime("%d days %H:%M")
else
	uptime = Time.at(uptime_data).utc.strftime("%H:%M")
end

puts uptime.to_s + " (" + sboot.to_s + ")"
#+END_SRC

Then i do ruby cmd and shell cmd at Ubuntu (chromebook).
Ruby: 28 days 09:23 (Tue Sep 26 15:19:58 +0900 2017)
Bash: 00:43:33 up 27 days,  9:23,  0 users,  load average: 0.01, 0.10, 0.21

Why the result is different? Ruby result is more 1 day than shell result.
Guide me please... thanks in advance^^^

Sincerely, Byung-Hee.

-- 
^고맙습니다 _白衣從軍_ 감사합니다_^))//


Reply to: