From 5e83a862dba2c850a10fea11e814d593b2381f76 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 9 Apr 2022 14:03:17 +0300 Subject: [PATCH] Use centiseconds --- src/displayapp/screens/StopWatch.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index ce8d4a54..cc548068 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -10,11 +10,12 @@ using namespace Pinetime::Applications::Screens; namespace { TimeSeparated_t convertTicksToTimeSegments(const TickType_t timeElapsed) { - const int timeElapsedMillis = timeElapsed * 1000 / configTICK_RATE_HZ; + // Centiseconds + const int timeElapsedCentis = timeElapsed * 100 / configTICK_RATE_HZ; - const int hundredths = (timeElapsedMillis % 1000) / 10; // Get only the first two digits and ignore the last - const int secs = (timeElapsedMillis / 1000) % 60; - const int mins = (timeElapsedMillis / 1000) / 60; + const int hundredths = (timeElapsedCentis % 100); + const int secs = (timeElapsedCentis / 100) % 60; + const int mins = (timeElapsedCentis / 100) / 60; return TimeSeparated_t {mins, secs, hundredths}; }