Use centiseconds

This commit is contained in:
Riku Isokoski 2022-04-09 14:03:17 +03:00
parent 28ccf15e13
commit 5e83a862db

View File

@ -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};
}