diff options
Diffstat (limited to 'src/arch/posix/driver')
-rw-r--r-- | src/arch/posix/driver/uptime.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/posix/driver/uptime.cc b/src/arch/posix/driver/uptime.cc new file mode 100644 index 0000000..040b51c --- /dev/null +++ b/src/arch/posix/driver/uptime.cc @@ -0,0 +1,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; |