diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -72,6 +72,8 @@ char *strrchr _((const char*,const char)); #include <unistd.h> #endif +#include <time.h> + #ifdef __BEOS__ #include <net/socket.h> #endif @@ -10363,6 +10365,13 @@ static double timeofday() { struct timeval tv; +#ifdef CLOCK_MONOTONIC + struct timespec tp; + + if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) { + return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9; + } +#endif gettimeofday(&tv, NULL); return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6; } |