diff options
author | Clayton Smith <argilo@gmail.com> | 2020-01-30 22:29:02 -0500 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-02-04 13:23:17 +0100 |
commit | d90833f1a4a1e8bc243b68088e42cfde6fe080fe (patch) | |
tree | f7103c5ddf57dd2afda8bb436830c340bbcd8cf8 /gr-blocks/lib/throttle_impl.h | |
parent | c2500773476ab34fc6db64e1b7224aa9d171fa98 (diff) |
gr-blocks: use monotonic clock for throttle
To ensure that the throttle block operates normally even if the system
clock changes, I've switched it to use std::chrono::steady_clock, which
is a monotonic clock.
Diffstat (limited to 'gr-blocks/lib/throttle_impl.h')
-rw-r--r-- | gr-blocks/lib/throttle_impl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h index 9817201e0f..3e0c58fe87 100644 --- a/gr-blocks/lib/throttle_impl.h +++ b/gr-blocks/lib/throttle_impl.h @@ -12,6 +12,7 @@ #define INCLUDED_GR_THROTTLE_IMPL_H #include <gnuradio/blocks/throttle.h> +#include <chrono> namespace gr { namespace blocks { @@ -19,10 +20,11 @@ namespace blocks { class throttle_impl : public throttle { private: - boost::system_time d_start; + std::chrono::time_point<std::chrono::steady_clock> d_start; size_t d_itemsize; uint64_t d_total_samples; - double d_samps_per_tick, d_samps_per_us; + double d_sample_rate; + std::chrono::duration<double> d_sample_period; bool d_ignore_tags; public: |