From 209908f70000e69a77244a2fa8eda56422bd4c23 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 23 Dec 2020 13:16:26 -0700 Subject: [PATCH] libtemporal: improve/fix implementation of timepos_t::operator+=(timepos_t) --- libs/temporal/timeline.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/temporal/timeline.cc b/libs/temporal/timeline.cc index a800756e89..cb118597eb 100644 --- a/libs/temporal/timeline.cc +++ b/libs/temporal/timeline.cc @@ -705,14 +705,20 @@ timepos_t::operator+=(timepos_t const & d) { if (d.is_beats() == is_beats()) { + /* same time domain, keep flag bit, add values */ + v = build (flagged(), val() + d.val()); } else { + /* different time domain, return a value in the same domain as + * this one + */ + if (is_beats()) { - v = build (false, val() + d.ticks()); + v = build (true, val() + d.ticks()); } else { - v = build (true, val() + d.superclocks()); + v = build (false, val() + d.superclocks()); } }