diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2015-11-14 02:55:22 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2015-11-14 02:55:22 +0000 |
commit | 839db6dccd416417f15771beef234b54cd058627 (patch) | |
tree | 78ecc458c60ef8849dd9ecfc51aefdfa68501d9f | |
parent | 8cd0c73fb54658e9176c4b78a57bc9e99eab4faf (diff) | |
download | ast2050-flashrom-839db6dccd416417f15771beef234b54cd058627.zip ast2050-flashrom-839db6dccd416417f15771beef234b54cd058627.tar.gz |
Use nanosleep() instead of usleep() where available
Usleep() has been obsolete for quite a while.
The only target that uses it without alternative is DOS.
Corresponding to flashrom svn r1899.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r-- | udelay.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -22,6 +22,7 @@ #ifndef __LIBPAYLOAD__ #include <unistd.h> +#include <time.h> #include <sys/time.h> #include <stdlib.h> #include <limits.h> @@ -174,9 +175,11 @@ void internal_sleep(unsigned int usecs) { #if IS_WINDOWS Sleep((usecs + 999) / 1000); -#else +#elif defined(__DJGPP__) sleep(usecs / 1000000); usleep(usecs % 1000000); +#else + nanosleep(&(struct timespec){usecs / 1000000, (usecs * 1000) % 1000000000UL}, NULL); #endif } |