Lines 42-47
Link Here
|
42 |
#if defined(PIPE_OS_UNIX) |
42 |
#if defined(PIPE_OS_UNIX) |
43 |
# include <unistd.h> /* usleep */ |
43 |
# include <unistd.h> /* usleep */ |
44 |
# include <time.h> /* timeval */ |
44 |
# include <time.h> /* timeval */ |
|
|
45 |
# if defined(PIPE_OS_BSD) |
46 |
# include <sys/param.h> |
47 |
# endif |
45 |
# include <sys/time.h> /* timeval */ |
48 |
# include <sys/time.h> /* timeval */ |
46 |
# include <sched.h> /* sched_yield */ |
49 |
# include <sched.h> /* sched_yield */ |
47 |
# include <errno.h> |
50 |
# include <errno.h> |
Lines 55-61
Link Here
|
55 |
int64_t |
58 |
int64_t |
56 |
os_time_get_nano(void) |
59 |
os_time_get_nano(void) |
57 |
{ |
60 |
{ |
58 |
#if defined(PIPE_OS_LINUX) |
61 |
#if defined(PIPE_OS_BSD) || defined(PIPE_OS_LINUX) |
59 |
|
62 |
|
60 |
struct timespec tv; |
63 |
struct timespec tv; |
61 |
clock_gettime(CLOCK_MONOTONIC, &tv); |
64 |
clock_gettime(CLOCK_MONOTONIC, &tv); |
Lines 95-101
os_time_get_nano(void)
Link Here
|
95 |
void |
98 |
void |
96 |
os_time_sleep(int64_t usecs) |
99 |
os_time_sleep(int64_t usecs) |
97 |
{ |
100 |
{ |
98 |
#if defined(PIPE_OS_LINUX) |
101 |
#if defined(PIPE_OS_LINUX) || (defined(__FreeBSD__) && __FreeBSD_version >= 1100513) |
99 |
struct timespec time; |
102 |
struct timespec time; |
100 |
time.tv_sec = usecs / 1000000; |
103 |
time.tv_sec = usecs / 1000000; |
101 |
time.tv_nsec = (usecs % 1000000) * 1000; |
104 |
time.tv_nsec = (usecs % 1000000) * 1000; |