Add fractional Duration total accessors#43
Conversation
|
Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself). |
There was a problem hiding this comment.
Pull request overview
This PR extends Duration’s accessor API with fractional “total” conversions, allowing callers to retrieve the full duration in seconds/minutes/hours as Double without truncation, and adds targeted tests to validate the new behavior.
Changes:
- Add
Duration::as_seconds_f64,Duration::as_minutes_f64, andDuration::as_hours_f64accessors. - Document precision limits inherent to
Doublefor large magnitudes. - Add tests covering fractional, negative, and zero durations for the new accessors.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/tempo.mbt |
Adds new Double-returning total accessor APIs for seconds/minutes/hours. |
src/tempo_test.mbt |
Adds unit tests validating the new fractional accessor behavior. |
src/pkg.generated.mbti |
Exposes the new public APIs in the generated interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Choir: comment-only review received — routed to |
|
Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval). |
|
Choir: fixes pushed by |
|
Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself). |
Closes tempo-z7j.3. Adds Duration::as_seconds_f64, Duration::as_minutes_f64, and Duration::as_hours_f64 by converting total nanoseconds to Double and dividing by Double unit literals. Includes exact public API tests for fractional, negative, and zero cases.
Verification
Generated by Choir from commands executed in the leaf workspace.
moon fmt --checkmoon test --target wasm-gcmoon test --target jsmoon test --target native