Skip to content

Commit

Permalink
refactor: format string, ChronoUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciator committed Nov 8, 2023
1 parent 7298cbc commit 5c8c3eb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public static void main(final String[] args) throws Exception {
.setTag("unit", "temperature")
.setField("avg", 24.5)
.setField("max", 45.0)
.setTimestamp(Instant.now().minusSeconds(-20 * 60));
.setTimestamp(Instant.now().minus(20, ChronoUnit.MINUTES));
client.writePoint(point1);

Point point2 = Point.measurement("stat")
.setTag("unit", "temperature")
.setField("avg", 28.0)
.setField("max", 40.3)
.setTimestamp(Instant.now().minusSeconds(-10 * 60));
.setTimestamp(Instant.now().minus(10, ChronoUnit.MINUTES));
client.writePoint(point2);

Point point3 = Point.measurement("stat")
Expand Down Expand Up @@ -94,8 +94,8 @@ public static void main(final String[] args) throws Exception {
return;
}

System.out.println(timestamp.toString() + ": avg is "
+ row.getFloatField("avg") + ", max is " + row.getFloatField("max"));
System.out.printf("%s: avg is %s, max is %s%n",
timestamp, row.getFloatField("avg"), row.getFloatField("max"));

//
// write back downsampled date to 'stat_downsampled' measurement
Expand Down

0 comments on commit 5c8c3eb

Please sign in to comment.