Add usleep call for visual studio

usleep isn't part of standard windows, so we add a version of it based
on Sleep();
This commit is contained in:
dkulwin 2015-11-04 18:40:57 -06:00
parent 2454a18404
commit 58d15ecb9a
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <sys/utime.h>
#include <string.h>
#include <signal.h>
@ -105,6 +106,8 @@ const char *strerror(int e)
#endif
#ifndef HAVE_UTIMES
int utimes(char *filename, struct timeval *tvp)
{
struct utimbuf ub;
@ -176,7 +179,16 @@ int usleep(unsigned int useconds)
return nanosleep(&ts, NULL);
}
#endif
#else
#if !defined(HAVE_USLEEP)
int usleep(unsigned int useconds)
{
Sleep(useconds/1000);
return 1;
}
#endif
#endif
#ifndef HAVE_TCGETPGRP
pid_t