summaryrefslogtreecommitdiff
path: root/src/arch/posix/driver/uptime.cc
blob: 040b51c8485f70995e573404da8176ecd47b2558 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include "driver/uptime.h"
#include <time.h>

uint64_t Uptime::get()
{
	struct timespec ts;
	clock_gettime(CLOCK_REALTIME, &ts);
	return (uint64_t)ts.tv_nsec + (1000000ULL * ((uint64_t)ts.tv_sec % 256));
}

Uptime uptime;