Skip to content

Add fractional Duration total accessors#43

Merged
brickfrog merged 2 commits into
mainfrom
main.ergo-task-add-fractional-total-1780418501483-596086
Jun 2, 2026
Merged

Add fractional Duration total accessors#43
brickfrog merged 2 commits into
mainfrom
main.ergo-task-add-fractional-total-1780418501483-596086

Conversation

@brickfrog

Copy link
Copy Markdown
Owner

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 --check
    • exit: 0
    • head: ddf8427
    • output tail:
Finished. moon: no work to do
  • moon test --target wasm-gc
    • exit: 0
    • head: ddf8427
    • output tail:
Total tests: 285, passed: 285, failed: 0.
  • moon test --target js
    • exit: 0
    • head: ddf8427
    • output tail:
Total tests: 285, passed: 285, failed: 0.
  • moon test --target native
    • exit: 0
    • head: ddf8427
    • output tail:
Total tests: 285, passed: 285, failed: 0.

@brickfrog

Copy link
Copy Markdown
Owner Author

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).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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, and Duration::as_hours_f64 accessors.
  • Document precision limits inherent to Double for 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.

Comment thread src/tempo.mbt
Comment thread src/tempo.mbt
Comment thread src/tempo.mbt
@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: comment-only review received — routed to main.ergo-task-add-fractional-total-1780418501483-596086 (leaf pane).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: fixes pushed by main.ergo-task-add-fractional-total-1780418501483-596086 — resolving threads and checking gates (not merged yet).

@brickfrog

Copy link
Copy Markdown
Owner Author

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).

@brickfrog brickfrog merged commit e532246 into main Jun 2, 2026
2 checks passed
@brickfrog brickfrog deleted the main.ergo-task-add-fractional-total-1780418501483-596086 branch June 2, 2026 16:50
@brickfrog brickfrog mentioned this pull request Jun 2, 2026
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