[go: up one dir, main page]

Menu

[r20]: / dtorrent / trunk / compat.c  Maximize  Restore  History

Download this file

24 lines (19 with data), 496 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "def.h"
#include "compat.h"
#ifndef HAVE_CLOCK_GETTIME
int clock_gettime(clockid_t clock_id, struct timespec *tp)
{
int r = 0;
#if defined(HAVE_GETTIMEOFDAY)
struct timeval tv;
if( (r = gettimeofday(&tv, (struct timezone *)0)) == 0 ){
tp->tv_sec = tv.tv_sec;
tp->tv_nsec = tv.tv_usec * 1000;
}
#else
#error No suitable precision timing functions appear to be available!
#error Please report this problem and identify your system platform.
#endif
return r;
}
#endif