6 package com.vesoft.nebula.client.graph.data;
8 import com.vesoft.nebula.Duration;
9 import java.util.Objects;
12 private final Duration duration;
18 this.duration = duration;
25 return duration.seconds;
32 return duration.microseconds;
39 return duration.months;
46 return String.format(
"duration({months:%d, seconds:%d, microseconds:%d})",
52 public String toString() {
53 long totalSeconds = duration.seconds + duration.microseconds / 1000000;
54 int remainMicroSeconds = duration.microseconds % 1000000;
55 String microSends = String.format(
"%06d", remainMicroSeconds) +
"000";
56 return String.format(
"P%dMT%d.%sS", duration.months, totalSeconds, microSends);
60 public boolean equals(Object o) {
64 if (o ==
null || getClass() != o.getClass()) {
68 return duration.months == that.getMonths()
69 && duration.seconds == that.getSeconds()
70 && duration.microseconds == that.getMicroseconds();
74 public int hashCode() {
75 return Objects.hash(duration);
String getDurationString()
int getMicroseconds()
@retrun utc duration microseconds
DurationWrapper(Duration duration)
DurationWrapper is a wrapper for the duration type of nebula-graph.