Skip to content

Commit 37cb199

Browse files
[EGD-4169] Fix call timer (#908)
1 parent 0bdc633 commit 37cb199

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* `[desktop][gui]` Fixed SIM passcodes to accepts variable length
1616
* `[desktop][messages]` Fixed notifications display and navigation
1717
* `[cellular]` Fixed 32 bit UCS2 codes handling.
18+
* `[call]` Fixed incorrect start of call duration timer
1819

1920
### Other
2021

module-apps/application-call/windows/CallWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ namespace gui
174174
// show state of the window
175175
switch (state) {
176176
case State::INCOMING_CALL: {
177-
runCallTimer();
178-
179177
bottomBar->setActive(gui::BottomBar::Side::CENTER, true);
180178
bottomBar->setText(gui::BottomBar::Side::LEFT, utils::localize.get(strings::answer), true);
181179
bottomBar->setText(gui::BottomBar::Side::RIGHT, utils::localize.get(strings::reject), true);
@@ -430,15 +428,16 @@ namespace gui
430428
void CallWindow::runCallTimer()
431429
{
432430
static const sys::ms one_second = 1000;
433-
callStart = utils::time::Timestamp();
434431
stop_timer = false;
435432
auto timer = std::make_unique<app::GuiTimer>("CallTime", application, one_second, Timer::Continous);
436433
timerCallback = [&](Item &, Timer &timer) {
437434
if (stop_timer) {
438435
timer.stop();
439436
detachTimer(timer);
440437
}
441-
updateDuration(utils::time::Duration(utils::time::Timestamp(), callStart));
438+
std::chrono::time_point<std::chrono::system_clock> systemUnitDuration(callDuration);
439+
updateDuration(std::chrono::system_clock::to_time_t(systemUnitDuration));
440+
callDuration++;
442441
application->refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
443442
return true;
444443
};
@@ -448,6 +447,7 @@ namespace gui
448447

449448
void CallWindow::stopCallTimer()
450449
{
450+
callDuration = std::chrono::seconds().zero();
451451
stop_timer = true;
452452
}
453453
} /* namespace gui */

module-apps/application-call/windows/CallWindow.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace gui
1818
{
1919
private:
2020
gui::KeyInputMappedTranslation translator;
21-
utils::time::Timestamp callStart;
21+
std::chrono::seconds callDuration = std::chrono::seconds().zero();
2222
bool stop_timer = false;
2323

2424
protected:

0 commit comments

Comments
 (0)