usleep was removed in POSIX 2008 and is optionally unavailable with
uClibc-ng.
[ ML: include <time.h> and improve indentation. ]
Signed-off-by: Rosen Penev <rosenp@gmail.com>
#include <sys/time.h>
#include <sys/types.h>
#include <termios.h>
+#include <time.h>
#include <unistd.h>
#include <wchar.h>
* @param int - number of usecs to wait for.
*/
void newtDelay(unsigned int usecs) {
- usleep(usecs);
+ struct timespec t = { usecs / 1000000, (usecs % 1000000) * 1000 };
+
+ nanosleep(&t, NULL);
}
struct eventResult newtDefaultEventHandler(newtComponent c,