Skip to content

Commit 44516de

Browse files
committed
Merge pull request influxdata#71 from caoli5288/pull2
Set system time as point's default time.
2 parents 6229a11 + 573e964 commit 44516de

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/org/influxdb/dto/Point.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,14 @@ public Point build() {
142142
Point point = new Point();
143143
point.setFields(this.fields);
144144
point.setMeasurement(this.measurement);
145-
point.setPrecision(this.precision);
145+
if (this.time != 0) {
146+
point.setTime(this.time);
147+
point.setPrecision(this.precision);
148+
} else {
149+
point.setTime(System.currentTimeMillis());
150+
point.setPrecision(TimeUnit.MILLISECONDS);
151+
}
146152
point.setTags(this.tags);
147-
point.setTime(this.time);
148153
return point;
149154
}
150155
}
@@ -283,4 +288,4 @@ private StringBuilder formatedTime() {
283288
return sb;
284289
}
285290

286-
}
291+
}

0 commit comments

Comments
 (0)