Skip to content
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

Reverse order of min in FiniteDatetimeRange.intersection #196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Peter554
Copy link
Contributor

@Peter554 Peter554 commented Jan 30, 2025

In #187 the implementation of FiniteDatetimeRange.intersection was optimised. This introduced a very subtle change in behaviour. Previously when left.end was equal to right.end then the right.end was favoured. In #187 the implementation was (unintentionally) changed to favour left.end.

This change reverses that, to again favour right.end.

This really shouldn't matter, but it can be significant when the TZ of left and right are different. Eventually we'd like to prevent this kind of mixed TZ behaviour (see #192), but in the short term it seems reasonable to make this tiny change to make things consistent again with how they were before and in order to unblock xocto releases / install in Kraken.

@Peter554 Peter554 self-assigned this Jan 30, 2025
@Peter554 Peter554 requested a review from leamingrad January 30, 2025 13:36
@Peter554 Peter554 marked this pull request as ready for review January 30, 2025 13:36
Copy link

@leamingrad leamingrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but could we add a test to cover this situation (since it is subtle behaviour)?

In #187 the implementation of
FiniteDatetimeRange.intersection was optimised. This introduced a very
subtle change in behaviour. Previously when left.end was equal to
right.end then the right.end was favoured. In
#187 the implementation was
(unintentionally) changed to favour left.end.

This change reverses that, to again favour right.end.

This really shouldn't matter, but it can be signidicant when
the TZ of left and right are different. Eventually we'd like
to prevent this kind of mixed TZ behaviour (see
#192), but in the short
term it seems reasonable to make this tiny change to make things
consistent again with how they were before.
@Peter554 Peter554 force-pushed the change-order-of-dt-range-interesection branch from 48ec2c2 to d49e9e3 Compare January 30, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants