mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated.
This commit is contained in:
@@ -115,8 +115,15 @@
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/keysym.h> /* defines XK_* macros */
|
||||
|
||||
/* This is temporary until the code is rewritten to use nanosleep(). */
|
||||
#ifndef usleep
|
||||
#if _POSIX_C_SOURCE >= 199309L /* have nanosleep() */
|
||||
# undef usleep
|
||||
# define usleep(usec) { \
|
||||
struct timespec ts; \
|
||||
ts.tv_nsec = (usec) * 1000; \
|
||||
nanosleep(&ts, NULL); }
|
||||
# endif
|
||||
|
||||
#ifndef usleep /* have neither nanosleep() nor usleep() */
|
||||
# define usleep(x) sleep(((x)+499999)/1000000)
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user