From 70e27e0bf218c6d135d6fcf539ea169b9241f545 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 16 Apr 2020 21:38:33 -0600 Subject: fix Beats::operator-() --- libs/temporal/temporal/beats.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/temporal/temporal/beats.h b/libs/temporal/temporal/beats.h index 5c8538641a..a7c8696db3 100644 --- a/libs/temporal/temporal/beats.h +++ b/libs/temporal/temporal/beats.h @@ -228,7 +228,14 @@ public: } Beats operator-() const { - return Beats(-_beats, -_ticks); + /* must avoid normalization here, which will convert a negative + value into a valid beat position before zero, which is not + we want here. + */ + Beats b (_beats, _ticks); + b._beats = -b._beats; + b._ticks = -b._ticks; + return b; } template -- cgit v1.2.3