Add '24hour-delta' timestamp option

When enabled this option will timestamp new lines with the time elapsed
since the line before.

This is a very useful feature to identify which events takes the most
time.
This commit is contained in:
Martin Lund 2022-07-05 16:05:35 +02:00
parent eecfa6485c
commit 732c0c3f89
4 changed files with 38 additions and 8 deletions

View file

@ -117,6 +117,10 @@ const char* timestamp_token(enum timestamp_t timestamp)
return "24hour-start";
break;
case TIMESTAMP_24HOUR_DELTA:
return "24hour-delta";
break;
case TIMESTAMP_ISO8601:
return "iso8601";
break;
@ -133,10 +137,22 @@ enum timestamp_t timestamp_option_parse(const char *arg)
if (arg != NULL)
{
if (strcmp(arg, "24hour-start") == 0)
if (strcmp(arg, "none") == 0)
{
return TIMESTAMP_NONE;
}
else if (strcmp(arg, "24hour") == 0)
{
return TIMESTAMP_24HOUR;
}
else if (strcmp(arg, "24hour-start") == 0)
{
return TIMESTAMP_24HOUR_START;
}
else if (strcmp(arg, "24hour-delta") == 0)
{
return TIMESTAMP_24HOUR_DELTA;
}
else if (strcmp(arg, "iso8601") == 0)
{
return TIMESTAMP_ISO8601;