aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/timer/TimerController.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2023-02-23 17:32:11 +0200
committerRiku Isokoski <riksu9000@gmail.com>2023-02-23 23:17:18 +0200
commit05f404950afeef26393b3e385bdb6d77df423e86 (patch)
tree427f9f8578078ae472bacc9f564b13895ab3cf22 /src/components/timer/TimerController.cpp
parent56b6291ab779acd8cd5af007a0a97397a93a33f2 (diff)
TimerController: Use chrono for durations
Diffstat (limited to 'src/components/timer/TimerController.cpp')
-rw-r--r--src/components/timer/TimerController.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/TimerController.cpp
index ea945213..5e7f1eed 100644
--- a/src/components/timer/TimerController.cpp
+++ b/src/components/timer/TimerController.cpp
@@ -13,17 +13,17 @@ void TimerController::Init(Pinetime::System::SystemTask* systemTask) {
timer = xTimerCreate("Timer", 1, pdFALSE, this, TimerCallback);
}
-void TimerController::StartTimer(uint32_t duration) {
- xTimerChangePeriod(timer, pdMS_TO_TICKS(duration), 0);
+void TimerController::StartTimer(std::chrono::milliseconds duration) {
+ xTimerChangePeriod(timer, pdMS_TO_TICKS(duration.count()), 0);
xTimerStart(timer, 0);
}
-uint32_t TimerController::GetTimeRemaining() {
+std::chrono::milliseconds TimerController::GetTimeRemaining() {
if (IsRunning()) {
TickType_t remainingTime = xTimerGetExpiryTime(timer) - xTaskGetTickCount();
- return (remainingTime * 1000 / configTICK_RATE_HZ);
+ return std::chrono::milliseconds(remainingTime * 1000 / configTICK_RATE_HZ);
}
- return 0;
+ return std::chrono::milliseconds(0);
}
void TimerController::StopTimer() {