From b2c7cdef67aaec1a4a123843aebf3942a73e429b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 18 Jun 2018 18:14:43 +0200 Subject: Avoid negative time intervals in odr-zmq2edi --- src/zmq2edi/EDISender.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/zmq2edi/EDISender.cpp b/src/zmq2edi/EDISender.cpp index 2921b3c..38fcae9 100644 --- a/src/zmq2edi/EDISender.cpp +++ b/src/zmq2edi/EDISender.cpp @@ -234,8 +234,6 @@ void EDISender::send_eti_frame(uint8_t* p, metadata_t metadata) const auto t_release = t_frame + milliseconds(tist_delay_ms); const auto t_now = system_clock::now(); - const auto wait_time = t_release - t_now; - const auto duration_0 = milliseconds(0); /* etiLog.level(debug) << "seconds " << seconds + posix_timestamp_1_jan_2000; @@ -243,7 +241,8 @@ void EDISender::send_eti_frame(uint8_t* p, metadata_t metadata) etiLog.level(debug) << "wait " << wait_time.count(); */ - if (wait_time > duration_0) { + if (t_release > t_now) { + const auto wait_time = t_release - t_now; std::this_thread::sleep_for(wait_time); wait_times.push_back(duration_cast(wait_time).count()); } -- cgit v1.2.3