aboutsummaryrefslogtreecommitdiffstats
path: root/src/Utils.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-08-15 10:58:11 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-08-15 10:58:11 +0200
commita759d1fae861e7f0836283dae5dce49dae6528fc (patch)
tree23694a2bcc40cb075988eda7300b1ee42cf07d61 /src/Utils.cpp
parent2980f73251c631960fcbe048eda861afa7a1be89 (diff)
downloaddabmod-a759d1fae861e7f0836283dae5dce49dae6528fc.tar.gz
dabmod-a759d1fae861e7f0836283dae5dce49dae6528fc.tar.bz2
dabmod-a759d1fae861e7f0836283dae5dce49dae6528fc.zip
Add parameters sdr.synchronous and mainloop.running_since
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 94f198c..20297ea 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -25,7 +25,8 @@
along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "sstream"
+#include <ctime>
+#include <sstream>
#include "Utils.h"
#include "GainControl.h"
#if defined(HAVE_PRCTL)
@@ -304,3 +305,13 @@ std::chrono::milliseconds transmission_frame_duration(unsigned int dabmode)
}
}
+
+time_t get_clock_realtime_seconds()
+{
+ struct timespec t;
+ if (clock_gettime(CLOCK_REALTIME, &t) != 0) {
+ throw std::runtime_error(std::string("Failed to retrieve CLOCK_REALTIME") + strerror(errno));
+ }
+
+ return t.tv_sec;
+}