Prepared for optional use of clock_gettime()

This commit is contained in:
Thomas Schmitt 2013-06-09 15:43:02 +00:00
parent 7d44b745a8
commit 5cd14ba075
2 changed files with 6 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2013.06.09.152602" #define Cdrskin_timestamP "2013.06.09.154237"

View File

@ -17,6 +17,7 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
/* ts A80914 : This is unneeded. Version info comes from libburn.h. /* ts A80914 : This is unneeded. Version info comes from libburn.h.
@ -351,13 +352,15 @@ double burn_get_time(int flag)
int ret; int ret;
struct timeval tv; struct timeval tv;
#ifdef Xorriso_use_clock_gettime_monotoniC #ifdef Libburn_use_clock_gettime_monotoniC
#ifdef _POSIX_MONOTONIC_CLOCK
struct timespec tp; struct timespec tp;
ret = clock_gettime(CLOCK_MONOTONIC, &tp) ret = clock_gettime(CLOCK_MONOTONIC, &tp);
if (ret == 0) if (ret == 0)
return ((double) tp.tv_sec) + ((double) tp.tv_nsec) * 1.0e-9; return ((double) tp.tv_sec) + ((double) tp.tv_nsec) * 1.0e-9;
#endif /* _POSIX_MONOTONIC_CLOCK */
#endif /* Xorriso_use_clock_gettime_monotoniC */ #endif /* Xorriso_use_clock_gettime_monotoniC */
ret = gettimeofday(&tv, NULL); ret = gettimeofday(&tv, NULL);