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

Support an easier to use duration string #185

Closed
TristonianJones opened this issue Mar 30, 2021 · 2 comments · Fixed by #200
Closed

Support an easier to use duration string #185

TristonianJones opened this issue Mar 30, 2021 · 2 comments · Fixed by #200
Assignees

Comments

@TristonianJones
Copy link
Collaborator

Currently, the cel-spec indicates that the duration string format accepted within protobuf libraries is what CEL can consume; however, this means that the only valid duration unit is 's' for seconds. A more human-readable format that understands inputs at the granularity of hours, minutes, and seconds would be a vast improvement.

@jcking
Copy link
Collaborator

jcking commented Mar 30, 2021

We should probably push for protobuf to accept the new units as well. I would suggest the following.

"1d" -> google.protobuf.Duration{
  seconds: 86400
}
"1h" -> google.protobuf.Duration{
  seconds: 3600
}
"1m" -> google.protobuf.Duration{
  seconds: 60
}
"1s" -> google.protobuf.Duration{
  seconds: 1
}
"1ms" -> google.protobuf.Duration{
  nanos: 1000000
}
"1us" -> google.protobuf.Duration{
  nanos: 1000
}
"1ns" -> google.protobuf.Duration{
  nanos: 1
}

@TristonianJones
Copy link
Collaborator Author

@jcking I think up to the hour level is about as far as we could reasonably support, but yes, I would love it if proto could support more than just the 's' suffix.

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 a pull request may close this issue.

2 participants