Slashdot Mirror


Is there an Uptime Limit?

Juniks[for dumminger asks: "O'Reilly's Linux Device Drivers states that: 'When the timer interrupt occurs, the jiffies values is incremented. jiffies is thus number of clock ticks since the operating system was booted; it is decleared in "linux/sched.h" as unsigned long volatile, and it will overflow in one and a third year of continuous operation.' So, will I lose my beloved uptime? I am almost there, and all my dignity will go down the drain if this is true. And not to mention my reputaition at work..." I might be mistaken, but I thought Linux took a time_t value during boot as reported by the RTC and used that for uptime computations. Can someone clarify?

For those that don't know GCC, time_t is the ANSI datatype for date/time storage.

1 of 33 comments (clear)

  1. Relevant bits... by trims · · Score: 5
    ... are in the procps package. Specifically, in the proc/sysinfo.c file.

    I gave it a cursory look over, and yes, the time is read directly from /proc/uptime. OK, so where do these values get set? (and the values in /proc/uptime are in seconds).

    So we peek at the kernel source... Lo and Behold, in include/linux/kernel.h we find that uptime is a long int. 64-bits, that is. An even better explanation of the jiffies vs. seconds calculations are in fs/proc/array.c.

    The final answer is: uptime is a long integer (2^63, since it seems to be signed), with values in seconds. So, it should wrap around after being up for 2.9e11 years or so ( almost 300 billion years).

    I wouldn't worry.

    -Erik

    If you have the source, all things become transparent...

    --
    There are always four sides to every story: your side, their side, the truth, and what really happened.