Web lists-archives.com

Re: off topic: uptime question




Hi,

Byung-Hee wrote:
> uptime = Time.at(uptime_data).utc.strftime("%d days %H:%M")
> 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

Google sent me to
  https://apidock.com/ruby/DateTime/strftime

My guess is that ruby's "%d - Day of the month" begins counting at 1
whereas bash begins at 0 days.

(You should better compute the time interval days from the seconds
 difference. %d will probably rollover at 31.)


Have a nice day :)

Thomas