ok2c commented on a change in pull request #147: Time values
URL:
https://github.com/apache/httpcomponents-core/pull/147#discussion_r321975556
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
##########
@@ -371,13 +347,43 @@ public int toSecondsIntBound() {
return asBoundInt(toSeconds());
}
+ public Timeout toTimeout() {
+ return Timeout.of(duration, timeUnit);
+ }
+
@Override
- public String toString() {
- return String.format(Locale.ROOT, "%,d %s", duration, timeUnit);
+ public int compareTo(final TimeValue other) {
+ if (other != null) {
+ final TimeUnit targetTimeUnit = min(other.getTimeUnit());
+ return Long.compare(convert(targetTimeUnit),
other.convert(targetTimeUnit));
+ } else {
+ return -Integer.MAX_VALUE;
Review comment:
@michael-o Are you about throwing `NullPointerException` or is this a
personal preference?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]