Repository navigation
Conversation
|
Thanks for this. Millisecond support (#22) is a useful addition, and the regex is nicely restricted: millis only after a seconds field, with an invalid-input test for each edge case. 1. Float drift in the new branch (please fix before merge) Summing with >>> parse('9ms')
0.009000000000000001
>>> parse('4.1m500ms')
246.49999999999997
>>> parse('2.3d1ms')
198720.00099999996In a sweep of Suggested fix: sum the millis branch with 2. Duplicate code path The new 3. Merge conflict This now conflicts with |
|
Thanks for the precise examples. Merged current master, retained both sets of regression tests, and folded milliseconds into the Decimal calculation path instead of keeping a separate float sum. The new millisecond assertions now use assertEqual, including all three drift examples. All 64 tests and the README/module doctests pass; a sweep from 0ms through 20000ms has zero mismatches against ms / 1000. Prepared with Codex assistance. |
Summary
Closes #22 (also relates to #17).
Add millisecond units (
ms,msec(s),millis, andmillisecond(s)) to the existing unit-based parser. They can be used alone or after larger units, such as1s250msand1 minute, 500 milliseconds. Whole-second totals still return integers; fractional totals return floats.This leaves the existing calculation path for expressions without milliseconds unchanged, keeping the fractional-unit fix in #38 separate. Clock-format changes are out of scope.
Validation
git diff --checkpassed.Codex assisted with the implementation, tests, and this description. No human review or hosted CI result is claimed; Copilot review was not available locally.