Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Dec 2001 14:36:27 -0500
From:      Will Andrews <will@csociety.org>
To:        "Thomas Krause, CI" <freebsd@chef-ingenieur.de>
Cc:        freebsd-isp@freebsd.org
Subject:   Re: How to get uptime?
Message-ID:  <20011202143626.N56385@squall.waterspout.com>
In-Reply-To: <5.1.0.14.2.20011202200919.00b1a450@mta.webmatic.de>
References:  <5.1.0.14.2.20011202200919.00b1a450@mta.webmatic.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 02, 2001 at 08:12:14PM +0100, Thomas Krause, CI wrote:
> ist there an other way to get the system uptime then the "uptime" command?
> I need the uptime for a for a script which is called by mrtg. The output
> of "uptime" is difficult to parse, eg:

Yes.  sysctl kern.boottime.  In C, you can get that via
syctlbyname(), then get the current time w/ time(), then use
difftime() to get the number of seconds difference.

-- 
wca

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011202143626.N56385>