From 430ec5cd7ae4dd8f8a4c9c7affb8d79a4a7d911d Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 22 Sep 2024 21:10:17 -0400 Subject: [PATCH] docs timestamp --- reader/src/main/java/com/rusefi/mlv/LoggingContext.java | 6 +++--- .../main/java/com/rusefi/sensor_logs/BinarySensorLog.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reader/src/main/java/com/rusefi/mlv/LoggingContext.java b/reader/src/main/java/com/rusefi/mlv/LoggingContext.java index 03a7e23..950f9d5 100644 --- a/reader/src/main/java/com/rusefi/mlv/LoggingContext.java +++ b/reader/src/main/java/com/rusefi/mlv/LoggingContext.java @@ -12,7 +12,7 @@ public class LoggingContext { public Map currentSnapshot = new HashMap<>(); - AtomicReference currentTime = new AtomicReference<>(); + private final AtomicReference currentTimeUs = new AtomicReference<>(); public BinarySensorLog getBinaryLogEntryBinarySensorLog(Collection entries, String outputFileName) { return new BinarySensorLog<>(o -> { @@ -25,7 +25,7 @@ public BinarySensorLog getBinaryLogEntryBinarySensorLog(Collecti public void writeLogContent(List packets, BinarySensorLog log, LoggingStrategy.PacketLogger logger) { for (CANPacket packetContent : packets) { - currentTime.set((long) (packetContent.getTimeStamp() * 1000)); + currentTimeUs.set((long) (packetContent.getTimeStamp() * 1000)); boolean needLine = logger.takeValues(packetContent); if (needLine) log.writeSensorLogLine(); @@ -34,6 +34,6 @@ public void writeLogContent(List packets, BinarySensorLog this.currentTime.get(); + return () -> this.currentTimeUs.get(); } } diff --git a/reader/src/main/java/com/rusefi/sensor_logs/BinarySensorLog.java b/reader/src/main/java/com/rusefi/sensor_logs/BinarySensorLog.java index d749ead..acdc002 100644 --- a/reader/src/main/java/com/rusefi/sensor_logs/BinarySensorLog.java +++ b/reader/src/main/java/com/rusefi/sensor_logs/BinarySensorLog.java @@ -30,7 +30,7 @@ public BinarySensorLog(Function valueProvider, Collection sensors, } public interface TimeProvider { - long currentTimestamp(); + long currentTimestampUs(); } @Override @@ -56,7 +56,7 @@ public void writeSensorLogLine() { try { stream.write(0); stream.write(lineCounter++); - stream.writeShort((int) (timeProvider.currentTimestamp() * 100)); + stream.writeShort((int) (timeProvider.currentTimestampUs() * 100)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos);