2005-07-19 15:21:51 +02:00
|
|
|
#include "sysutil.h"
|
2005-05-31 16:44:49 +02:00
|
|
|
|
2015-09-21 15:07:55 +02:00
|
|
|
/*
|
|
|
|
* Retrieve the system's uptime (number of clock ticks since system boot),
|
|
|
|
* real time (corrected number of clock ticks since system boot), and
|
|
|
|
* boot time (in number of seconds since the UNIX epoch).
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
getuptime(clock_t * uptime, clock_t * realtime, time_t * boottime)
|
2005-05-31 16:44:49 +02:00
|
|
|
{
|
2015-09-21 15:07:55 +02:00
|
|
|
struct minix_kerninfo *minix_kerninfo;
|
2005-05-31 16:44:49 +02:00
|
|
|
|
2015-09-21 15:07:55 +02:00
|
|
|
minix_kerninfo = get_minix_kerninfo();
|
|
|
|
|
|
|
|
/* We assume atomic 32-bit field retrieval. TODO: 64-bit support. */
|
|
|
|
*uptime = minix_kerninfo->kclockinfo->uptime;
|
|
|
|
*realtime = minix_kerninfo->kclockinfo->realtime;
|
|
|
|
*boottime = minix_kerninfo->kclockinfo->boottime;
|
|
|
|
|
|
|
|
return OK;
|
2005-05-31 16:44:49 +02:00
|
|
|
}
|