Skip to content

Commit

Permalink
use utc timestamps in log file
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Aug 25, 2024
1 parent f6961bd commit 0ea1d41
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/actionlogger/Utils.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package actionlogger;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.Instant;
import java.time.temporal.ChronoUnit;

public class Utils {

private final static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");

public static String getTimestamp() {
var now = LocalDateTime.now();
return now.format(DATE_TIME_FORMATTER);
return Instant.now().truncatedTo(ChronoUnit.SECONDS).toString();
}
}

0 comments on commit 0ea1d41

Please sign in to comment.