500 days: The uptime never reached

This post was written by eli on September 11, 2009
Posted Under: Linux,oddities

I know it’s stupid, but there’s something cool about very long uptimes. I think it begins when the uptime reaches 100 days: You think twice before rebooting your Linux machine: Is it really necessary?

The truth is that without really paying attention to it, my Linux box approached 500 days. I noticed that, because I wanted to upgrade my kernel (it’s about time…). But first I wanted to know what I’m breaking. 493 days, uptime told me. So I decided to wait a week. Childish, but it’s 500 days after all.

Today is the day. My computer has been up for 500 days. Here comes the celebration:

[eli@localhost eli]$ uptime
  1:51pm  up 3 days, 10:01,  4 users,  load average: 0.21, 0.05, 0.01

Oops. That’s not 500 days! And I’m sure that the computer hasn’t rebooted. Conclusion: My uptime counter has wrapped to zero.

Let’s get to the root of this:

[eli@localhost eli]$ cat /proc/uptime
295330.71 41278547.60

The left number is the uptime, in seconds.  To the right is the idle time, in seconds as well.

It just so happens that the kernel counts the uptime in jiffies, which is 1/100 of a second. Since my computer is a 32-bit Intel, the counter can only count 2^32 jiffies, which is 42949672.96 seconds, which happens to be 497.1 days (divide by 60, 60 again, and then 24). After that, the counter starts over from zero. What a nasty trick…

And since we’re at it, why not check up the idle time? 41278547.60 seconds is 477.76 days, which tells something about how much I use my computer. In fact, it’s more like a housekeeping server (mail, routing and stuff), so no wonder it’s idle most of the time. A quick calculation shows that it was active no more than 4.5% of its 500 days of uptime. Hmmm…

Anyhow, I’m sure that whoever wrote the uptime counter had a little laught about idiots like me who think it’s cool to see the uptime reach 500 days. Don’t count the jiffies, he must have said, make the jiffies count.

Reader Comments

500 days: The uptime never reached
Reason for that is not
“Since my computer is a 32-bit Intel…”
but the use of linux-kernel version <= 2.4.x ?

My computer too is a 32-bit Intel box
running linux-kernel version is 2.6.x
and has been running 889 days now… :)

Written By Simo Laakso on June 2nd, 2014 @ 16:37

Add a Comment

required, use real name
required, will not be published
optional, your blog address