X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnuradio-core%2Fsrc%2Flib%2Fgeneral%2Fgr_throttle.cc;h=88219c1c8031410c17353a569479864f6133acce;hb=ea29b08aeb54227e6628f655ccfdb96fe4d8c378;hp=33f3e0862c6906bf5402a86a5954bb8e22ce9459;hpb=09a1e803a9e6587c78d20cdf16891e5295874668;p=debian%2Fgnuradio diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc index 33f3e086..88219c1c 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.cc +++ b/gnuradio-core/src/lib/general/gr_throttle.cc @@ -29,9 +29,13 @@ #include #include #include +#include #ifdef HAVE_TIME_H #include #endif +#if !defined(HAVE_NANOSLEEP) && defined(HAVE_SSLEEP) +#include +#endif #ifdef HAVE_NANOSLEEP @@ -80,7 +84,7 @@ gr_throttle::work (int noutput_items, const char *in = (const char *) input_items[0]; char *out = (char *) output_items[0]; -#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_NANOSLEEP) +#if defined(HAVE_GETTIMEOFDAY) // // If our average sample rate exceeds our target sample rate, // delay long enough to reduce to our target rate. @@ -96,10 +100,14 @@ gr_throttle::work (int noutput_items, double actual_samples_per_sec = d_total_samples / t; if (actual_samples_per_sec > d_samples_per_sec){ // need to delay double delay = d_total_samples / d_samples_per_sec - t; +#ifdef HAVE_NANOSLEEP struct timespec ts; ts.tv_sec = (time_t)floor(delay); ts.tv_nsec = (long)((delay - floor(delay)) * 1e9); gr_nanosleep(&ts); +#elif HAVE_SSLEEP + Sleep( (DWORD)(delay*1000) ); +#endif } #endif