From: Aki Tuomi Date: Sat, 4 Oct 2014 11:00:18 +0000 (+0300) Subject: Use nanosleep instead of usleep X-Git-Tag: rec-3.7.0-rc1~229^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22cc5a36d0503852b47bc5450c2376866976a136;p=thirdparty%2Fpdns.git Use nanosleep instead of usleep --- diff --git a/pdns/unix_utility.cc b/pdns/unix_utility.cc index e85e306144..c6530cc4c9 100644 --- a/pdns/unix_utility.cc +++ b/pdns/unix_utility.cc @@ -119,7 +119,11 @@ unsigned int Utility::sleep(unsigned int sec) void Utility::usleep(unsigned long usec) { - ::usleep(usec); + struct timespec ts; + ts.tv_sec = usec / 1000000; + ts.tv_nsec = (usec % 1000000) * 1000; + // POSIX.1 recommends using nanosleep instead of usleep + ::nanosleep(&ts, NULL); }