diff options
Diffstat (limited to 'src/Utils.h')
-rw-r--r-- | src/Utils.h | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/Utils.h b/src/Utils.h index 6a36baf..9e88488 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -3,7 +3,7 @@ Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -36,6 +36,7 @@ #include <stdio.h> #include <time.h> #include <string> +#include <chrono> void printUsage(const char* progName); @@ -43,22 +44,6 @@ void printVersion(void); void printStartupInfo(void); -inline long timespecdiff_us(struct timespec& oldTime, struct timespec& time) -{ - long tv_sec; - long tv_nsec; - if (time.tv_nsec < oldTime.tv_nsec) { - tv_sec = time.tv_sec - 1 - oldTime.tv_sec; - tv_nsec = 1000000000L + time.tv_nsec - oldTime.tv_nsec; - } - else { - tv_sec = time.tv_sec - oldTime.tv_sec; - tv_nsec = time.tv_nsec - oldTime.tv_nsec; - } - - return tv_sec * 1000 + tv_nsec / 1000; -} - // Set SCHED_RR with priority prio (0=lowest) int set_realtime_prio(int prio); @@ -68,3 +53,6 @@ void set_thread_name(const char *name); // Convert a channel like 10A to a frequency double parseChannel(const std::string& chan); +// dabMode is either 1, 2, 3, 4, corresponding to TM I, TM II, TM III and TM IV. +// throws a runtime_error if dabMode is not one of these values. +std::chrono::milliseconds transmission_frame_duration(unsigned int dabmode); |