diff --git a/modules/base/dashboard/dashboarditemelapsedtime.cpp b/modules/base/dashboard/dashboarditemelapsedtime.cpp index ef839ace01..bd0dda43b5 100644 --- a/modules/base/dashboard/dashboarditemelapsedtime.cpp +++ b/modules/base/dashboard/dashboarditemelapsedtime.cpp @@ -114,6 +114,7 @@ DashboardItemElapsedTime::DashboardItemElapsedTime(const ghoul::Dictionary& dict const Parameters p = codegen::bake(dictionary); _formatString = p.formatString.value_or(_formatString); + addProperty(_formatString); _referenceTime.onChange([this]() { _referenceJ2000 = Time::convertTime(_referenceTime); @@ -146,21 +147,19 @@ void DashboardItemElapsedTime::render(glm::vec2& penPosition) { using namespace std::chrono; const TimeUnit lowestTime = TimeUnit(_lowestTimeUnit.value()); - const std::string_view lowestUnitS = nameForTimeUnit(lowestTime, false); - const std::string_view lowestUnitP = nameForTimeUnit(lowestTime, true); const std::vector> ts = splitTime(delta); std::string time; for (const std::pair& t : ts) { - time += std::format("{} {} ", t.first, t.second); - if (t.second == lowestUnitS || t.second == lowestUnitP) { + if (timeUnitFromString(t.second) < lowestTime) { // We have reached the lowest unit the user was interested in break; } + time += std::format("{} {} ", t.first, t.second); } // Remove the " " at the end - time = time.substr(0, time.size() - 2); + time = time.substr(0, time.size() - 1); RenderFont( *_font,