X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Feventl.c;h=499239143dd6463d5bc02a78a0f6b69512f8bced;hb=941e9e05bd43e7066746ef3ea7478dd65877af58;hp=1d72235e67a095a946a7487f8e8d6471dbdd7fd7;hpb=e230ff7e920fc1b9a997e5edc64b8946e41a0d33;p=pazpar2-moved-to-github.git diff --git a/src/eventl.c b/src/eventl.c index 1d72235..4992391 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #endif +#include #include #include @@ -167,7 +168,7 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) IOCHAN p, *nextp; fd_set in, out, except; int res, max; - static struct timeval nullto = {0, 0}, to; + static struct timeval to; struct timeval *timeout; FD_ZERO(&in); @@ -310,6 +311,18 @@ void iochan_man_events(iochan_man_t man) event_loop(man, &man->channel_list); } +void pazpar2_sleep(double d) +{ +#ifdef WIN32 + Sleep( (DWORD) (d * 1000)); +#else + struct timeval tv; + tv.tv_sec = floor(d); + tv.tv_usec = (d - floor(d)) * 1000000; + select(0, 0, 0, 0, &tv); +#endif +} + /* * Local variables: * c-basic-offset: 4