Add uptime counter in DateTimeController and display it in SystemInfo screen.

This commit is contained in:
JF
2020-06-07 20:04:43 +02:00
parent baafb96f30
commit e22c0609b5
3 changed files with 18 additions and 3 deletions

View File

@@ -47,7 +47,8 @@ void DateTime::UpdateTime(uint32_t systickCounter) {
previousSystickCounter = 0xffffff - (rest - systickCounter);
}
currentDateTime += std::chrono::seconds (correctedDelta);
currentDateTime += std::chrono::seconds(correctedDelta);
uptime += std::chrono::seconds(correctedDelta);
auto dp = date::floor<date::days>(currentDateTime);
auto time = date::make_time(currentDateTime-dp);

View File

@@ -21,6 +21,7 @@ namespace Pinetime {
uint8_t Seconds() const { return second; }
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const { return currentDateTime; }
std::chrono::seconds Uptime() const { return uptime; }
private:
uint16_t year = 0;
Months month = Months::Unknown;
@@ -32,7 +33,7 @@ namespace Pinetime {
uint32_t previousSystickCounter = 0;
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> currentDateTime;
std::chrono::seconds uptime {0};
};
}
}