You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/10/20 18:19:53 UTC
[commons-lang] branch master updated: Proper Javadoc list
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 426ebb13e Proper Javadoc list
new 902b1ce39 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-lang.git
426ebb13e is described below
commit 426ebb13ee04af4f7d7efcb6338e86b3a4ccca98
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Oct 20 14:18:26 2023 -0400
Proper Javadoc list
Internal refactoring
---
.../org/apache/commons/lang3/time/StopWatch.java | 26 +++++++++++++++-------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/time/StopWatch.java b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
index e21ddd92e..0e3afa3fc 100644
--- a/src/main/java/org/apache/commons/lang3/time/StopWatch.java
+++ b/src/main/java/org/apache/commons/lang3/time/StopWatch.java
@@ -46,12 +46,12 @@ import org.apache.commons.lang3.StringUtils;
* resume before suspend or unsplit before split.
* </p>
*
- * <p>
- * 1. split(), suspend(), or stop() cannot be invoked twice<br>
- * 2. unsplit() may only be called if the watch has been split()<br>
- * 3. resume() may only be called if the watch has been suspend()<br>
- * 4. start() cannot be called twice without calling reset()
- * </p>
+ * <ol>
+ * <li>{@link #split()}, {@link #suspend()}, or {@link #stop()} cannot be invoked twice</li>
+ * <li>{@link #unsplit()} may only be called if the watch has been {@link #split()}</li>
+ * <li>{@link #resume()} may only be called if the watch has been {@link #suspend()}</li>
+ * <li>{@link #start()} cannot be called twice without calling {@link #reset()}</li>
+ * </ol>
*
* <p>This class is not thread-safe</p>
*
@@ -327,7 +327,7 @@ public class StopWatch {
* @since 2.1
*/
public long getSplitTime() {
- return getSplitNanoTime() / NANO_2_MILLIS;
+ return nanosToMillis(getSplitNanoTime());
}
/**
@@ -375,7 +375,7 @@ public class StopWatch {
* @return the time in milliseconds
*/
public long getTime() {
- return getNanoTime() / NANO_2_MILLIS;
+ return nanosToMillis(getNanoTime());
}
/**
@@ -428,6 +428,16 @@ public class StopWatch {
return runningState.isSuspended();
}
+ /**
+ * Converts nanoseconds to milliseconds.
+ *
+ * @param nanos nanoseconds to convert.
+ * @return milliseconds conversion result.
+ */
+ private long nanosToMillis(long nanos) {
+ return nanos / NANO_2_MILLIS;
+ }
+
/**
* Resets the stopwatch. Stops it if need be.
*