diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java index 6c0846cb414..a4bfad01fd8 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java @@ -164,14 +164,14 @@ String formatOptionalTimestamp(final Optional maybeTimestamp) { @VisibleForTesting String formatTimestamp(final UInt64 arrivalTimestamp) { - final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS"); + final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS"); final Date date = new Date(arrivalTimestamp.longValue()); return df.format(date); } @VisibleForTesting String generateTimestamp(final TimeProvider timeProvider) { - final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS"); + final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS"); final Date date = new Date(timeProvider.getTimeInMillis().longValue()); return df.format(date); } diff --git a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java index 697711d3a73..e77dd7b26c8 100644 --- a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java +++ b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java @@ -165,20 +165,14 @@ void formatTimestamp_shouldFormatDate() { final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true); final String formattedTimestamp = manager.formatOptionalTimestamp(Optional.of(timeProvider.getTimeInMillis())); - - final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS"); - final Date expectedDate = new Date(timeProvider.getTimeInMillis().longValue()); - assertThat(formattedTimestamp).isEqualTo(df.format(expectedDate)); + assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00"); } @Test void generateTimestamp_shouldGenerateTimestamp() { final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true); final String formattedTimestamp = manager.generateTimestamp(timeProvider); - - final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS"); - final Date expectedDate = new Date(timeProvider.getTimeInMillis().longValue()); - assertThat(formattedTimestamp).isEqualTo(df.format(expectedDate)); + assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00"); } private void checkBytesSavedToFile(final Path path, final Bytes expectedBytes) {