Skip to content

Commit

Permalink
support 'dmesg' style timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
Colum Paget committed Jan 10, 2024
1 parent f114691 commit b1a1a4e
Show file tree
Hide file tree
Showing 12 changed files with 1,519 additions and 8,233 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1.1 (2024-01-10)
----------------
* handle 'dmesg' style timestamps
* handle timestamps wrapped in [] <> or {}

1.0 (2023-12-10)
----------------
* Initial release
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OBJ=parse.o stats.o settings.o help.o libUseful-5/libUseful.a
FLAGS=-g -O2 -DPACKAGE_NAME=\"timediff\" -DPACKAGE_TARNAME=\"timediff\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"timediff\ 1.0\" -DPACKAGE_BUGREPORT=\"colums.projects@gmail.com\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBZ=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCAP=1
LIBS=-lcap -lssl -lcrypto -lz
STATIC_LIBS=libUseful-5/libUseful.a
OBJ=parse.o stats.o settings.o help.o
FLAGS=-g -O2 -DPACKAGE_NAME=\"timediff\" -DPACKAGE_TARNAME=\"timediff\" -DPACKAGE_VERSION=\"1.1\" -DPACKAGE_STRING=\"timediff\ 1.1\" -DPACKAGE_BUGREPORT=\"colums.projects@gmail.com\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -DHAVE_LIBUSEFUL_5_LIBUSEFUL_H=1 -DHAVE_LIBUSEFUL_5=1
LIBS=-lUseful-5 -lz
STATIC_LIBS=
PREFIX=/usr/local

all: $(OBJ)
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ All options that take a 'seconds' argument are floating point, so milliseconds c
TIMESTAMP FORMATS
=================

Timestamps are expected to be at the start of the line, and timediff can handle the formats `YYYY?mm?dd?HH:MM:SS?mmm` `HH:MM:SS?mmm YYYY?mm?dd` `bbb dd HH:MM:SS?mmm` where `?` is any character, `YYYY` is the year `mm` is the month number, `bbb` is the month short name (e.g. "Oct") `dd` is the day number, `HH` is the hour, `MM` is the minutes, `SS` is the seconds and `mmm` is milliseconds. The milliseconds component is optional, and if it's six digits instead of three, then timediff will parse it as nanoseconds.
Timestamps are expected to be at the start of the line, and timediff can handle the formats `YYYY?mm?dd?HH:MM:SS?mmm` `HH:MM:SS?mmm YYYY?mm?dd` `bbb dd HH:MM:SS?mmm` `SSSS.mmm` where `?` is any character, `YYYY` is the year `mm` is the month number, `bbb` is the month short name (e.g. "Oct") `dd` is the day number, `HH` is the hour, `MM` is the minutes, `SS` is the seconds and `mmm` is milliseconds. The milliseconds component is optional, and if it's six digits instead of three, then timediff will parse it as nanoseconds. The 'SSSS.mmm' format is 'kernel/dmesg' style, where number of seconds since some date, either the unix epoch or boot-up, are used to indicate the time.

timediff can also handle these formats if they're wrapped in characters like [] <> or {}

example formats that have been seen to work:

Expand All @@ -84,6 +86,7 @@ example formats that have been seen to work:
2023/12/05 10:30:14 Connection from 192.168.8.1
Dec 05 10:30:14 Connection from 192.168.8.1
10:30:14.182543 Connection from 192.168.8.1
[1000.234762] Starting up
```


Expand Down

0 comments on commit b1a1a4e

Please sign in to comment.