diff --git a/src/common.cc b/src/common.cc index ead2bbe4..d2a6ef88 100644 --- a/src/common.cc +++ b/src/common.cc @@ -40,7 +40,7 @@ #include "top.h" #include #include -#include +#include #include #include #include @@ -101,10 +101,10 @@ int update_uname(void) double get_time(void) { - struct timeval tv; + struct timespec tv; - gettimeofday(&tv, 0); - return tv.tv_sec + (tv.tv_usec / 1000000.0); + clock_gettime(CLOCK_MONOTONIC, &tv); + return tv.tv_sec + (tv.tv_nsec * 1e-9); } /* Converts '~/...' paths to '/home/blah/...'