Skip to content

Commit 58d15ec

Browse files
committed
Add usleep call for visual studio
usleep isn't part of standard windows, so we add a version of it based on Sleep();
1 parent 2454a18 commit 58d15ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

openbsd-compat/bsd-misc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#ifdef HAVE_SYS_TIME_H
2525
# include <sys/time.h>
2626
#endif
27+
#include <sys/utime.h>
2728

2829
#include <string.h>
2930
#include <signal.h>
@@ -105,6 +106,8 @@ const char *strerror(int e)
105106
#endif
106107

107108
#ifndef HAVE_UTIMES
109+
110+
108111
int utimes(char *filename, struct timeval *tvp)
109112
{
110113
struct utimbuf ub;
@@ -176,7 +179,16 @@ int usleep(unsigned int useconds)
176179
return nanosleep(&ts, NULL);
177180
}
178181
#endif
182+
#else
183+
#if !defined(HAVE_USLEEP)
184+
int usleep(unsigned int useconds)
185+
{
186+
Sleep(useconds/1000);
187+
return 1;
188+
}
179189
#endif
190+
#endif
191+
180192

181193
#ifndef HAVE_TCGETPGRP
182194
pid_t

0 commit comments

Comments
 (0)