diff options
author | farkasdvd <30418389+farkasdvd@users.noreply.github.com> | 2021-05-25 19:47:50 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-09 03:57:13 +0200 |
commit | e4b4a10a52805cc78a351f8b08b56d81d5a42b75 (patch) | |
tree | f91ee7f2aacb9dd15aff7379decb7fd50f8f438b /src/planner-snooze.cpp | |
parent | b584e8ffc67ee1ca07528f742227574aae95a7a3 (diff) | |
download | ayatana-indicator-datetime-e4b4a10a52805cc78a351f8b08b56d81d5a42b75.tar.gz ayatana-indicator-datetime-e4b4a10a52805cc78a351f8b08b56d81d5a42b75.tar.bz2 ayatana-indicator-datetime-e4b4a10a52805cc78a351f8b08b56d81d5a42b75.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.
Diffstat (limited to 'src/planner-snooze.cpp')
-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; |