[
https://issues.apache.org/jira/browse/LANG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17904476#comment-17904476
]
AB-xdev commented on LANG-1761:
-------------------------------
Thank you for the feedback.
{quote}- Using an API that does not define its scale in its name can lead to
bugs. Is it seconds, milliseconds, or something else?{quote}
I understand this problem.
However maybe an alternative method/alias called {{getMillis}} could be a
solution as it's also rather short and the name is more straightforward.
{quote}- OTOH, Java now has java.time package, no mistake is possible when you
use these types.
- Duration gives you more precision on modern Java platforms.{quote}
This is correct however our use cases is that StopWatch is mostly used for
debugging some code in combination with a logger like
{code:java}
StopWatch sw = StopWatch.createStarted()
LOG.info("Finished scheduled cleanUp..., took {}ms", sw.getTime());
{code}
And these methods are usually in the millisecond timescale (e.g. database work,
creating reports, ...) so we just use that and barely require something else.
> StopWatch: Undeprecate ``getTime``
> ----------------------------------
>
> Key: LANG-1761
> URL: https://issues.apache.org/jira/browse/LANG-1761
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.time.*
> Affects Versions: 3.16.0, 3.17.0
> Reporter: AB-xdev
> Assignee: Gary D. Gregory
> Priority: Major
> Fix For: 3.18.0
>
>
> The StopWatch {{getTime}} method [was deprecated in
> 3.16.0|https://github.com/apache/commons-lang/blob/08988a2c9029b1625115b3e3c6d30cb0fd1de57a/src/changes/changes.xml#L132-L135].
> We have some problems with the deprecation and would like to have it reverted:
> * We're unable to find the exact reasons for the deprecation because there is
> no issue/PR with further explanation. So for us it is not comprehensible.
> * {{getTime}} is a lot shorter as writing {{getDuration().toMillis()}} or
> {{getTime(TimeUnit.MILLISECONDS)}}
> * According to our tests {{getTime}} is around 10% faster than
> {{getDuration().toMillis()}} (as it just divides 2 longs instead of
> instantiating a new object)
> * The method has been present for the last 22 years and is well established.
> Changing it would result in a lot of code changes for us.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)