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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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?

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.

4 participants