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

Issue with TimeInterval Mod Function #349

Open
darianboggs opened this issue Jan 29, 2025 · 0 comments
Open

Issue with TimeInterval Mod Function #349

darianboggs opened this issue Jan 29, 2025 · 0 comments

Comments

@darianboggs
Copy link
Contributor

In some cases, the mod function overloaded for TimeInterval class produces incorrect results.

Below is a list of the incorrect result cases.

These are simple cases where I call mod(interval1, interval2). In each case, interval1 has a single unit set to nonzero and interval2 has a single unit set to nonzero. I am using the standard argument names to indicate which unit is set and what the value is. In all cases, I am using ESMF_KIND_I4 values.

Interval1 Interval2 mod(Interval1, Interval2)
mm = 1 s = 17 ZERO
mm = 1 m = 17 ZERO
mm = 1 h = 7 ZERO
mm = 1 d = 8 ZERO
yy = 1 s = 17 ZERO
yy = 1 m = 17 ZERO
yy = 1 h = 7 ZERO
yy = 1 d = 4 ZERO

where ZERO is a TimeInterval with all units == 0.

As you see, in each case Interval2 does not divide Interval1 evenly, and yet I found that mod(Interval1, Interval2) == ZERO.

In the cases where Interval2 is n days (n=8, n=4), it still returns an incorrect result. So it appears that the issue is not limited to a time-only duration dividing a date-only duration. It works correctly for (yy, mm), (d, h), (d, m), and (d, s), where (a, b) is (Interval1, Interval2). I did not test combinations with two time-only durations or combinations with durations have the same unit, and I did not test intervals where more than one unit is set.

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

No branches or pull requests

1 participant