You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Chetan Mehrotra <ch...@gmail.com> on 2015/07/14 11:25:07 UTC

Utility method for show time duration in words

Hi,

At times I feel a need for a utility method which can convert time in
mills to words for logs and JMX

There are two options I see

1. commons-lang DurationFormatterUtils [1] - Adding dependency to
whole of commons-lang might not make sense. So we can probably copy
it. It though depends on others common lang classes so copying would
be tricky

2. Guava Stopwatch private method [2] - Guava Stopwatch internally has
such a method but its not exposed. Probably we can copy that and
expose that in oak-commons.

Thoughts?

Chetan Mehrotra
[1] https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
[2] https://github.com/google/guava/blob/master/guava/src/com/google/common/base/Stopwatch.java#L216

Re: Utility method for show time duration in words

Posted by Angela Schreiber <an...@adobe.com>.
hi chetan

tobi already added something along that line to ConfigurationParameters.
-> see ConfigurationParameters.Milliseconds
afaik it's the opposite (converting human readable to milis), so we might
also think of extending that one.

regards
anglea

On 14/07/15 11:25, "Chetan Mehrotra" <ch...@gmail.com> wrote:

>Hi,
>
>At times I feel a need for a utility method which can convert time in
>mills to words for logs and JMX
>
>There are two options I see
>
>1. commons-lang DurationFormatterUtils [1] - Adding dependency to
>whole of commons-lang might not make sense. So we can probably copy
>it. It though depends on others common lang classes so copying would
>be tricky
>
>2. Guava Stopwatch private method [2] - Guava Stopwatch internally has
>such a method but its not exposed. Probably we can copy that and
>expose that in oak-commons.
>
>Thoughts?
>
>Chetan Mehrotra
>[1] 
>https://github.com/apache/commons-lang/blob/master/src/main/java/org/apach
>e/commons/lang3/time/DurationFormatUtils.java
>[2] 
>https://github.com/google/guava/blob/master/guava/src/com/google/common/ba
>se/Stopwatch.java#L216


Re: Utility method for show time duration in words

Posted by Davide Giannella <da...@apache.org>.
On 14/07/2015 10:25, Chetan Mehrotra wrote:
> ...
>
> 1. commons-lang DurationFormatterUtils [1] - Adding dependency to
> whole of commons-lang might not make sense. So we can probably copy
> it. It though depends on others common lang classes so copying would
> be tricky

I'm for not reinventing the wheel. What are the cons of adding this dep?
maybe we can find some more classes useful for oak in such dependency.

Davide