Skip to content

WIP: add some convenience functionality to Timestamp and Duration#747

Draft
hko-s wants to merge 3 commits into
rpgp:mainfrom
hko-s:time
Draft

WIP: add some convenience functionality to Timestamp and Duration#747
hko-s wants to merge 3 commits into
rpgp:mainfrom
hko-s:time

Conversation

@hko-s

@hko-s hko-s commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

rPGP's Timestamp and Duration APIs are currently very minimal.

This PR collects some ergonomics improvements, based on concrete needs in various software that uses rPGP.

@hko-s hko-s marked this pull request as draft March 31, 2026 19:59
@hko-s

hko-s commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

TODO: I tend to think we should make all potential u32 overflows into explicit Errors.

@hko-s

hko-s commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Notes to self:

  • time math could be saturating (avoids overflowing, but doesn't need fallible APIs)
  • some functions could take t: impl Into<SystemTime> for ergonomic interaction with chrono

@hko-s hko-s added this to the 0.19.1 milestone Apr 17, 2026
@hko-s hko-s modified the milestones: 0.20.0, v0.20.1 May 5, 2026
@hko-s

hko-s commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

The fact that Add can be called for a Duration with the value "0" (which is defined as an "infinite" duration) is a bit of a footgun.

Maybe the result should be an Option<Timestamp> that is None when adding a Duration that is 0?

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.

1 participant