return 0;
}
-void usleep(unsigned int useconds)
+PHPAPI int usleep(unsigned int useconds)
{
HANDLE timer;
LARGE_INTEGER due;
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 */
struct timeval it_value; /* current value */
};
+#ifndef timespec
+struct timespec
+{
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+
#define ITIMER_REAL 0 /*generates sigalrm */
#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
#define ITIMER_VIRT 1 /*generates sigvtalrm */
PHPAPI extern int setitimer(int which, const struct itimerval *value,
struct itimerval *ovalue);
+PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp );
+
#endif
#ifndef _PHP_WIN32_UNISTD_H
#define _PHP_WIN32_UNISTD_H
-void usleep(unsigned int useconds);
+PHPAPI int usleep(unsigned int useconds);
#endif