Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conversions between Swift.Duration and Google_Protobuf_Duration. #1745

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

allevato
Copy link
Collaborator

I saw one of our teams recently add this extension to their code base and it makes sense to have it here.

Instead of just calling libc's round internally like some of the other precision-lowering conversions, I decided to make the Duration-to-protobuf conversion more flexible by taking a FloatingPointRoundingRule and having it default to standard "school room" rounding. It might be a good idea to update the other precision-lowering conversions to match (deprecating and/or defaulting the old versions as appropriate).

Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

Love it. I have just written this code myself today!

@thomasvl
Copy link
Collaborator

Love it. I have just written this code myself today!

@FranzBusch – What do you think to @allevato question in the initial PR, should we also do a follow up to provide rounding arguments to any others?

@allevato allevato merged commit e9b49af into apple:main Jan 15, 2025
12 checks passed
@allevato allevato deleted the duration branch January 15, 2025 15:47
@thomasvl thomasvl added the 🆕 semver/minor Adds new public API. label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants