-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix split for negative whole day deltas #138
Conversation
@mority any doubts? |
I wonder if it would be easier to convert
Seems to do the job while being more readable. |
Isn't this what we do for the positive case? For the negative case we need something different. |
Sort of. For the positive case, we right now convert the
For a negative
So, when looking at the units, we convert However, we do not need two cases, if we convert into the atomic unit of minutes first.
|
@mority your version seems to work.
|
Yeah, I think all of our solutions so far, underflow for a low enough negative Edit: For clarification |
Yes, timestamps outside the internal timetable interval don't have to be representable. We already subtract 5 days from the user provided timetable begin. That should be enough for all use cases that come to my mind. |
Yes, i just wanted to point out that they "underflow" in a different way. ;-) |
Alright, just wanted to make sure that I did not miss anything. |
Ok, then maybe the best option is to have this approach for both cases. |
ed2bfcc
to
3b66452
Compare
Thank you! :) |
old version (not what you would expect):
auto [day, mam] = split_day_mam(day_idx_t{10}, delta_t{-1440});
EXPECT_EQ(day, day_idx_t{8});
EXPECT_EQ(mam.count(), 1440);
now:
auto [day, mam] = split_day_mam(day_idx_t{10}, delta_t{-1440});
EXPECT_EQ(day, day_idx_t{9});
EXPECT_EQ(mam.count(), 0);