diff options
author | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2015-11-14 02:55:22 +0000 |
---|---|---|
committer | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2015-11-14 02:55:22 +0000 |
commit | 83305e06a589aa8fb7b87c552128a7cd32e7a2b5 (patch) | |
tree | 78ecc458c60ef8849dd9ecfc51aefdfa68501d9f /udelay.c | |
parent | ab3d79163f58616e14b6f3a0f7e95ac6fc689ba3 (diff) | |
download | flashrom-83305e06a589aa8fb7b87c552128a7cd32e7a2b5.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.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1899 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'udelay.c')
-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 } |