diff options
author | farkasdvd <30418389+farkasdvd@users.noreply.github.com> | 2021-05-25 19:47:50 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-29 14:38:27 +0200 |
commit | 40eb68ee00f8cd45e6b6f0fa9eb77c2e4e106326 (patch) | |
tree | 9c2d7cb934690babe820d7a2c4534d5e12329b0e | |
parent | 7f696375f7ac20e7aca6a4c544ebbb9ec05c53cc (diff) | |
download | ayatana-indicator-datetime-40eb68ee00f8cd45e6b6f0fa9eb77c2e4e106326.tar.gz ayatana-indicator-datetime-40eb68ee00f8cd45e6b6f0fa9eb77c2e4e106326.tar.bz2 ayatana-indicator-datetime-40eb68ee00f8cd45e6b6f0fa9eb77c2e4e106326.zip |
Snooze starts from the current minute (#30)
SnoozePlanner just added the snooze duration to the start of the alarm. If the Snooze button was pressed 10 minutes after the alarm started and the snooze duration is 5 minutes then the alarm is planned into the past. This PR adds every whole minute passed between the start of the alarm and the Snooze action.
-rw-r--r-- | src/planner-snooze.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/planner-snooze.cpp b/src/planner-snooze.cpp index cb365ca..b81c912 100644 --- a/src/planner-snooze.cpp +++ b/src/planner-snooze.cpp @@ -59,7 +59,9 @@ public: appt.alarms.push_back(alarm); // reschedule the alarm to go off N minutes from now - const auto offset = std::chrono::minutes(m_settings->snooze_duration.get()); + // also take into count every whole minute since the alarm went off + const auto offset_to_now = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::microseconds(DateTime::NowLocal() - appt.begin)); + const auto offset = offset_to_now + std::chrono::minutes(m_settings->snooze_duration.get()); appt.begin += offset; appt.end += offset; appt.alarms[0].time += offset; |