This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch duration in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb-java-client.git
commit 22a46c25c0b8d15413fd6c109041e5da147ce438 Author: Gao Hongtao <[email protected]> AuthorDate: Wed May 29 22:50:49 2024 +0800 Fix wrong result of the Duration.ofDay Signed-off-by: Gao Hongtao <[email protected]> --- CHANGES.md | 1 + .../org/apache/skywalking/banyandb/v1/client/metadata/Duration.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b6deafb..cb63790 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Release Notes. * Fix MeasureQuery.SumBy to use SUM instead of COUNT * Add missing FloatFieldValue type in the Measure write operation +* Fix wrong result of the Duration.ofDay 0.6.0 ------------------ diff --git a/src/main/java/org/apache/skywalking/banyandb/v1/client/metadata/Duration.java b/src/main/java/org/apache/skywalking/banyandb/v1/client/metadata/Duration.java index ad5530e..6f91742 100644 --- a/src/main/java/org/apache/skywalking/banyandb/v1/client/metadata/Duration.java +++ b/src/main/java/org/apache/skywalking/banyandb/v1/client/metadata/Duration.java @@ -29,7 +29,8 @@ public class Duration { private static final Pattern DURATION_PATTERN = Pattern.compile("(((?<day>\\d+)d)?((?<hour>\\d+)h)?((?<minute>\\d+)m)?|0)"); private static final long MINUTES_PER_HOUR = 60; - private static final long MINUTES_PER_DAY = MINUTES_PER_HOUR * 24; + private static final long HOURS_PER_DAY = 24; + private static final long MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY; @EqualsAndHashCode.Exclude private volatile String text; @@ -100,6 +101,6 @@ public class Duration { } public static Duration ofDays(long days) { - return ofHours(days * MINUTES_PER_DAY); + return ofHours(days * HOURS_PER_DAY); } }
