diff options
-rw-r--r-- | linux/timer-lx.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linux/timer-lx.c b/linux/timer-lx.c index fd251e9251..8caf93ec62 100644 --- a/linux/timer-lx.c +++ b/linux/timer-lx.c @@ -3,6 +3,19 @@ #include <unistd.h> #include <sys/time.h> +int usec_sleep(int usec_delay) +{ +#if 1 + struct timespec ts; + ts.tv_sec = usec_delay / 1000000; + ts.tv_nsec = (usec_delay % 1000000) * 1000; + return nanosleep(&ts, NULL); +#else + return usleep(usec_delay); +#endif +} + + // Returns current time in microseconds unsigned int GetTimer(){ struct timeval tv; |