diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2015-02-22 11:51:20 -0500 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2015-02-22 11:51:22 -0500 |
commit | 8b0a67a2538d7c79b74086caab07735fa97aa047 (patch) | |
tree | d8e7b55f211a8ccf65bd0c07308b5cb6ff2e7ca0 /src | |
parent | Fix #169: Link to HACKING.md file (diff) | |
download | redshift-ng-8b0a67a2538d7c79b74086caab07735fa97aa047.tar.gz redshift-ng-8b0a67a2538d7c79b74086caab07735fa97aa047.tar.bz2 redshift-ng-8b0a67a2538d7c79b74086caab07735fa97aa047.tar.xz |
Fix #174: Use nanosleep() instead of usleep()
usleep() cannot sleep for more than 1000000 microseconds on certain
platforms. nanosleep() does not have this limitation.
Diffstat (limited to 'src')
-rw-r--r-- | src/systemtime.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/systemtime.c b/src/systemtime.c index 0d0cb85..9a971fa 100644 --- a/src/systemtime.c +++ b/src/systemtime.c @@ -24,6 +24,7 @@ # if _POSIX_TIMERS > 0 # include <time.h> # else +# include <time.h> # include <sys/time.h> # endif #else @@ -74,7 +75,10 @@ void systemtime_msleep(unsigned int msecs) { #ifndef _WIN32 - usleep(msecs*1000); + struct timespec sleep; + sleep.tv_sec = msecs / 1000; + sleep.tv_nsec = (msecs % 1000)*1000000; + nanosleep(&sleep, NULL); #else Sleep(msecs); #endif |