Switch to using clock_gettime() rather than gettimeofday().

This commit is contained in:
Nicholas J. Kain
2011-07-31 01:27:59 -04:00
parent 45c76dd548
commit ab4a2e0b97
3 changed files with 8 additions and 8 deletions

View File

@@ -28,15 +28,15 @@
#ifndef SYS_H_
#define SYS_H_
#include <sys/time.h>
#include <time.h>
#include "ndhc-defines.h"
#include "config.h"
static inline unsigned long long curms()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000ULL + tv.tv_usec / 1000ULL;
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000ULL;
}
extern char pidfile[MAX_PATH_LENGTH];