Skip to content

Commit 595b4a8

Browse files
authored
Fix wrong result of the Duration.ofDay (#58)
1 parent 96fdf04 commit 595b4a8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Release Notes.
1212

1313
* Fix MeasureQuery.SumBy to use SUM instead of COUNT
1414
* Add missing FloatFieldValue type in the Measure write operation
15+
* Fix wrong result of the Duration.ofDay
1516

1617
0.6.0
1718
------------------

src/main/java/org/apache/skywalking/banyandb/v1/client/metadata/Duration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class Duration {
2929
private static final Pattern DURATION_PATTERN =
3030
Pattern.compile("(((?<day>\\d+)d)?((?<hour>\\d+)h)?((?<minute>\\d+)m)?|0)");
3131
private static final long MINUTES_PER_HOUR = 60;
32-
private static final long MINUTES_PER_DAY = MINUTES_PER_HOUR * 24;
32+
private static final long HOURS_PER_DAY = 24;
33+
private static final long MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
3334

3435
@EqualsAndHashCode.Exclude
3536
private volatile String text;
@@ -100,6 +101,6 @@ public static Duration ofHours(long hours) {
100101
}
101102

102103
public static Duration ofDays(long days) {
103-
return ofHours(days * MINUTES_PER_DAY);
104+
return ofHours(days * HOURS_PER_DAY);
104105
}
105106
}

0 commit comments

Comments
 (0)