LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   kernel/system up time (https://www.linuxquestions.org/questions/linux-general-1/kernel-system-up-time-174805/)

iftiuk 04-26-2004 03:03 PM

kernel/system up time
 
Is there a library function that tells me how long the system or the kernel has been up.

Thanks
IFti

ranger_nemo 04-26-2004 03:21 PM

"uptime" will give you the info. If you want the text file, it's /proc/uptime.

iftiuk 04-26-2004 03:28 PM

Thanks. Isn't there any C callabel function?

elluva 04-26-2004 04:21 PM

dunno, but isn't it possible to just read /proc/uptime as text with the functions from stdio.h?

iftiuk 04-26-2004 04:55 PM

That's a good idea. Thanks.
When I did cat /proc/uptime it gave me
97983.95 85870.88

How to read from it. What are these 2 values and are they in seconds?

ranger_nemo 04-26-2004 05:29 PM

from "man proc"...
"""uptime This file contains two numbers: the uptime of the system (seconds), and the amount of time spent in idle process (seconds)."""

iftiuk 04-27-2004 07:57 AM

Great thanks for all the help

jfrey 04-27-2004 09:02 AM

iftiuk,
You can also download gkrellm as it has a running counter of machine uptime towards the bottom.
J

iftiuk 04-27-2004 09:30 AM

Thanks for letting me know


All times are GMT -5. The time now is 12:54 PM.