Skip to content

Issue with TimeInterval Mod Function #349

@darianboggs

Description

@darianboggs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions