Skip to content

Commit 5b5a6b5

Browse files
committed
Last fix for precision and time. influxdata#44
1 parent b7af0b6 commit 5b5a6b5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ void setPoints(final List<Point> points) {
222222
*/
223223
public BatchPoints point(final Point point) {
224224
point.getTags().putAll(this.tags);
225+
if (null != this.time) {
226+
point.setTime(this.time);
227+
}
228+
point.setPrecision(this.precision);
225229
this.points.add(point);
226230
return this;
227231
}

src/test/java/org/influxdb/TicketTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,11 @@ public void testTicket44() {
167167
point = Point.measurement("test").time(1, TimeUnit.MILLISECONDS).field("a", 1).build();
168168
batchPoints = BatchPoints.database("db").point(point).build();
169169
assertThat(batchPoints.lineProtocol()).asString().isEqualTo("test a=1 1000000\n");
170+
171+
point = Point.measurement("test").field("a", 1).build();
172+
batchPoints = BatchPoints.database("db").time(1, TimeUnit.MILLISECONDS).build();
173+
batchPoints = batchPoints.point(point);
174+
assertThat(batchPoints.lineProtocol()).asString().isEqualTo("test a=1 1000000\n");
175+
170176
}
171177
}

0 commit comments

Comments
 (0)