Use TimeUnit.TARGETUNIT.convert() to convert between time units [LUCENE-7014]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Re-phrased from @sarowe's [comment](https://issues.apache.org/jira/browse/LUCENE-6823?focusedCommentId=14941283&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14941283) :
System.nanoTime(), which is guaranteed to be monotonic, is now used to recored elapsed times. In several places, conversion from nano seconds to some target unit (e.g. seconds, milli seconds) is performed using hard-coded conversion constants, which is prone to mistakes.
It would be nice to use `TimeUnit.TARGETUNIT.convert(sourceDuration, TimeUnit.SOURCEUNIT)` instead.
---
Migrated from [LUCENE-7014](https://issues.apache.org/jira/browse/LUCENE-7014) by Ahmet Arslan (@iorixxx), updated Mar 07 2018
Attachments: [LUCENE-7014.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7014/LUCENE-7014.patch) (versions: 2)
Contributor guide
Assessment
This issue has not been assessed yet.