summaryrefslogtreecommitdiff
path: root/win32/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/time.c')
-rw-r--r--win32/time.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/win32/time.c b/win32/time.c
index 816eb63b14..808ce8d5bd 100644
--- a/win32/time.c
+++ b/win32/time.c
@@ -127,7 +127,7 @@ PHPAPI int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Inf
return 0;
}
-void usleep(unsigned int useconds)
+PHPAPI int usleep(unsigned int useconds)
{
HANDLE timer;
LARGE_INTEGER due;
@@ -138,6 +138,17 @@ void usleep(unsigned int useconds)
SetWaitableTimer(timer, &due, 0, NULL, NULL, 0);
WaitForSingleObject(timer, INFINITE);
CloseHandle(timer);
+ return 0;
+}
+
+PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
+{
+ if (rqtp->tv_nsec > 999999999) {
+ /* The time interval specified 1,000,000 or more microseconds. */
+ errno = EINVAL;
+ return -1;
+ }
+ return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 );
}
#if 0 /* looks pretty ropey in here */