From e853c9bd1835cf110ff47668a081ddbdbbfb7d77 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Wed, 23 Jan 2019 12:40:49 +0300 Subject: [PATCH] [notifications] Do not disturb from 9p.m. to 10 a.m. --- map/notifications/notification_manager.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/map/notifications/notification_manager.hpp b/map/notifications/notification_manager.hpp index 917b0ee8b4..c1ff57ce86 100644 --- a/map/notifications/notification_manager.hpp +++ b/map/notifications/notification_manager.hpp @@ -54,6 +54,12 @@ public: boost::optional GetNotification() { + // Do not disturb from 9p.m. to 10 a.m. + auto const time = notifications::Clock::to_time_t(notifications::Clock::now()); + auto const localTime = std::localtime(&time); + if (localTime->tm_hour <= 9 || localTime->tm_hour >= 21) + return {}; + return m_manager.GetNotification(); }