forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetuptime.c
More file actions
24 lines (20 loc) · 692 Bytes
/
Copy pathgetuptime.c
File metadata and controls
24 lines (20 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "sysutil.h"
/*
* 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)
{
struct minix_kerninfo *minix_kerninfo;
minix_kerninfo = get_minix_kerninfo();
/* We assume atomic 32-bit field retrieval. TODO: 64-bit support. */
if (uptime != NULL)
*uptime = minix_kerninfo->kclockinfo->uptime;
if (realtime != NULL)
*realtime = minix_kerninfo->kclockinfo->realtime;
if (boottime != NULL)
*boottime = minix_kerninfo->kclockinfo->boottime;
return OK;
}