Author: stefanct Date: Sat Nov 14 03:55:22 2015 New Revision: 1899 URL: http://flashrom.org/trac/flashrom/changeset/1899
Log: 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
Modified: trunk/udelay.c
Modified: trunk/udelay.c ============================================================================== --- trunk/udelay.c Sat Nov 14 03:55:12 2015 (r1898) +++ trunk/udelay.c Sat Nov 14 03:55:22 2015 (r1899) @@ -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 @@ { #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 }