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 for java.time.Duration #6808

Open
cowwoc opened this issue Jan 19, 2025 · 3 comments
Open

Support for java.time.Duration #6808

cowwoc opened this issue Jan 19, 2025 · 3 comments
Milestone

Comments

@cowwoc
Copy link
Contributor

cowwoc commented Jan 19, 2025

Is your enhancement related to a problem? Please describe

Having to store and specify durations using two separate constants is a bit of a pain.

Describe the solution you'd like

Given that the API requires JDK 11 and java.util.Duration was added in JDK 8, consider adding methods that take a Duration instead of (or alongside) the methods that currently take a TimeUnit. You can convert from one to the other using TimeUnit.convert() under the hood for backwards compatibility.

Describe alternatives you've considered

No response

Additional context

No response

@rohanKanojia
Copy link
Member

@cowwoc : we have a Duration class that accepts java.util.Duration in constructor. Does it help your use case?

@cowwoc
Copy link
Contributor Author

cowwoc commented Jan 19, 2025

I don't think so. I'm talking about about able to pass Durations into functions like waitUntilCondition().

@manusa
Copy link
Member

manusa commented Jan 20, 2025

Currently (and unfortunately), the time handling is quite messy in the client.

Depending on the module, we handle timestamps as Strings, MicroTime, Duration, and more.
It's very inconsistent and probably because along the years, upstream Kubernetes introduced additional time types, and our local models and extensions processors were implemented manually by different people.

The goal would be to unify all of our time formats to the Java standards.
This wasn't done in the scope of v7.0.0 to minimize the amount of breakages and allow for a smoother transition to this version for our users.

For v8, this is definitely one of the things we want to achieve.
Probably by providing backwards compatible getters and setters to also prevent big breaking changes.

@manusa manusa added this to the 8.0.0 milestone Jan 20, 2025
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

No branches or pull requests

3 participants