From 3ef3f5fe3180dde40b2716cb10c2143e8b396672 Mon Sep 17 00:00:00 2001 From: Maciej Borzecki Date: Tue, 12 May 2015 14:24:05 +0200 Subject: examples: replace usleep() with nanosleep() Accessing usleep() requires _BSD_SOURCE feature test macro to be set. However, _SVID_SOURCE is set as well, what will cause deprecation warnings when building with glibc >= 2.20. The patch replaced usleep() with nanosleep() to avoid these problems. --- examples/unix/platform_utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/unix/platform_utils.c b/examples/unix/platform_utils.c index 777d56b..1f3ff43 100644 --- a/examples/unix/platform_utils.c +++ b/examples/unix/platform_utils.c @@ -34,11 +34,8 @@ * ***** END LICENSE BLOCK ***** */ -/* For usleep */ -#define _BSD_SOURCE - #include - +#include #include #include @@ -51,5 +48,8 @@ uint64_t now_microseconds(void) void microsleep(int usec) { - usleep(usec); + struct timespec req; + req.tv_sec = 0; + req.tv_nsec = 1000 * usec; + nanosleep(&req, NULL); } -- cgit v1.2.1