You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2021/02/16 22:39:44 UTC

[GitHub] [httpcomponents-core] garydgregory commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

garydgregory commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780163476


   Hi @michael-o ,
   
   I think we might have our signals crossed on the concepts: 
   
   - A `TimeValue` is **not** an instant. A `TimeValue` is an amount of time, I should have been clearer in the Javadoc, for example, "5 SECONDS".  So yes, it is equivalent to a `java.time.Duration`. 
   - A `Timeout` is a specialization of a `TimeValue` to allow APIs to specify that an argument is represents the concept of "timeout" instead of a "plain" amount of time.
   - An instant, like a Java `Instant` is a point in the time-line like "January 16, 2010 at 17:27 PM UTC".
   - Java 8 provides further refinements like `Period`, so you can express concepts like "one a day", "once a week", "once a month", and so on.
   
   If we had started 5.0 on Java 8, I probably would not have added `TimeValue` and `Timeout`, but maybe... too late now ;-) I might have done so as a `Duration` wrapper since `Duration` is final. It's still nice to have a `Timeout` class I think. In fact I have `TimeValue` redone as a `Duration` wrapper in a local git stash, but it's not 100% there yet.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org