LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-26-2004, 03:03 PM   #1
iftiuk
Member
 
Registered: Apr 2004
Location: Washington DC
Posts: 43

Rep: Reputation: 15
kernel/system up time


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

Thanks
IFti
 
Old 04-26-2004, 03:21 PM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
"uptime" will give you the info. If you want the text file, it's /proc/uptime.
 
Old 04-26-2004, 03:28 PM   #3
iftiuk
Member
 
Registered: Apr 2004
Location: Washington DC
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks. Isn't there any C callabel function?
 
Old 04-26-2004, 04:21 PM   #4
elluva
Member
 
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600

Rep: Reputation: 30
dunno, but isn't it possible to just read /proc/uptime as text with the functions from stdio.h?
 
Old 04-26-2004, 04:55 PM   #5
iftiuk
Member
 
Registered: Apr 2004
Location: Washington DC
Posts: 43

Original Poster
Rep: Reputation: 15
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?
 
Old 04-26-2004, 05:29 PM   #6
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
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)."""
 
Old 04-27-2004, 07:57 AM   #7
iftiuk
Member
 
Registered: Apr 2004
Location: Washington DC
Posts: 43

Original Poster
Rep: Reputation: 15
Great thanks for all the help
 
Old 04-27-2004, 09:02 AM   #8
jfrey
Member
 
Registered: May 2003
Location: California
Distribution: Mandrake
Posts: 50

Rep: Reputation: 15
iftiuk,
You can also download gkrellm as it has a running counter of machine uptime towards the bottom.
J
 
Old 04-27-2004, 09:30 AM   #9
iftiuk
Member
 
Registered: Apr 2004
Location: Washington DC
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for letting me know
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set and sync system time with time server?? servnov Linux - Newbie 6 12-03-2013 07:55 PM
system crashes time to time Artik Debian 2 12-02-2005 07:19 AM
How to syncronize my system time by public time server? hakansun Linux - Networking 1 09-10-2004 05:10 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM
Updating System time from some Inet time server Steave Linux - General 6 12-21-2001 02:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration