From 2340fcf2606883e4e49ad880d2883196600f0a1b Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr" Date: Mon, 16 Nov 2020 17:52:41 -0800 Subject: [PATCH] core: Time::RoundTo (unit) to round Time to any unit Merge of !475 --- src/core/model/nstime.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 5b0005f66..090990534 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -546,6 +546,16 @@ public: } /**@}*/ // Get Times as Numbers in Specified Units + /** + * Round a Time to a specific unit. + * Rounding is to nearest integer. + * \return The Time rounded to the specific unit. + */ + Time RoundTo (enum Unit unit) const + { + return From (this->To (unit).Round (), unit); + } + /** * Attach a unit to a Time, to facilitate output in a specific unit. *