Skip to content

Commit

Permalink
Improve journal time extraction
Browse files Browse the repository at this point in the history
It will now work even if the log file is completely empty, whereas it
previously required at least one log message to exist.
  • Loading branch information
dfandrich committed Aug 24, 2024
1 parent 01a3268 commit 487e82c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions automtime
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ mtime_jpeg () {
# File type: journal (journald log file)
# requires: systemd
mtime_journal () {
RAWTIME=$(journalctl -e -o export --output-fields=__REALTIME_TIMESTAMP --file "$f" | grep ^__REALTIME_TIMESTAMP= | tail -1 | sed -E 's/^.*=([0-9]{10})(.*)$/\1.\2/')
# $RAWTIME is like 1234567890.123456
TIME=$(normalize_time_tz "@$RAWTIME")
RAWTIME=$(TZ=UTC journalctl --header --file "$f" | sed -E -n 's/Tail realtime timestamp: (.*) \(.*\)$/\1/p')
# $RAWTIME is like Sat 2024-08-24 14:33:29 UTC
TIME=$(normalize_time_tz "$RAWTIME")
}

# File type: jxl (JPEG XL)
Expand Down

0 comments on commit 487e82c

Please sign in to comment.