From b22856e85c9f4a913d5ec27d2976dde03569bc48 Mon Sep 17 00:00:00 2001 From: ATATC Date: Wed, 23 Aug 2023 14:50:26 +0800 Subject: [PATCH] `Log.Time`: bug fixed: `getDuration` always returns 0 as it compares to itself. --- src/main/java/com/atatctech/packages/log/Log.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/atatctech/packages/log/Log.java b/src/main/java/com/atatctech/packages/log/Log.java index 8eb092c..fe40143 100644 --- a/src/main/java/com/atatctech/packages/log/Log.java +++ b/src/main/java/com/atatctech/packages/log/Log.java @@ -144,7 +144,7 @@ public long getDuration(@NotNull Unit unit) { } public long getDuration() { - return getDuration(this); + return getDuration(new Time()); } public @NotNull Milliseconds getDurationAsGap() { @@ -156,7 +156,7 @@ public long getDuration(@NotNull Time time, @NotNull Unit unit) { } public long getDuration(@NotNull Time time) { - return Math.abs(time.getBaseTime() - getBaseTime()); + return calculateDuration(this, time); } public @NotNull TimePeriod getDurationAsGap(@NotNull Time time, @NotNull Unit unit) {