-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
services: fix casting on toast #427
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you fix this, you should fix all sections interacting with the incorrect time - even in this file are two. Also, did you rerun the unit-tests on your system? Maybe they catch that on MacOS and help you find those issues.
55f1910
to
1590abd
Compare
7a22ca5
to
4706616
Compare
@@ -13,11 +13,12 @@ NotificationData OswServiceTaskNotifier::createNotification(std::chrono::time_po | |||
|
|||
std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> getTimeToFire(int hours, int minutes) { | |||
auto utcTime = std::chrono::system_clock::from_time_t(OswHal::getInstance()->getUTCTime()); | |||
auto currentTime = utcTime + std::chrono::seconds{static_cast<int>(OswHal::getInstance()->getTimezoneOffsetPrimary())}; | |||
auto utcTimeInSeconds = std::chrono::duration_cast<std::chrono::seconds>(utcTime.time_since_epoch()); | |||
auto currentTime = utcTimeInSeconds + std::chrono::seconds{static_cast<int>(OswHal::getInstance()->getTimezoneOffsetPrimary())}; | |||
auto currentDate = date::sys_days(floor<date::days>(currentTime)); | |||
auto scheduledTime = std::chrono::hours{hours} + std::chrono::minutes{minutes} + std::chrono::seconds{0}; | |||
auto timeToFire = currentDate + scheduledTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duration, right? Why did you not cast here?
if (auto it = scheduler.begin(); | ||
it != scheduler.end() && currentTime >= it->first) { | ||
it != scheduler.end() && currentTime.count() >= it->first.time_since_epoch().count()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...same here?
890efcf
to
9478a8e
Compare
fix time casting issue on toast feature.