1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Improves the meaning and result of time_since_flush().

This commit is contained in:
Thomas Harte 2020-12-01 18:35:07 -05:00
parent 03e2b6a265
commit 3162873a9c

View File

@ -86,9 +86,13 @@ template <class T, int multiplier = 1, int divider = 1, class LocalTimeScale = H
return &object_;
}
/// @returns the amount of time since the object was last flushed.
forceinline LocalTimeScale time_since_flush() const {
return time_since_update_;
/// @returns the amount of time since the object was last flushed, in the target time scale.
forceinline TargetTimeScale time_since_flush() const {
// TODO: does this handle conversions properly where TargetTimeScale != LocalTimeScale?
if constexpr (divider == 1) {
return time_since_update_;
}
return TargetTimeScale(time_since_update_.as_integral() / divider);
}
/// Flushes all accumulated time.