Added timestamp format "epoch-usec"

This timestamp format will print the seconds since epoch along with
subdivision in microseconds.

Example:
 [1748009585.087083] tio v3.9-8-g2fb788f-dirty
 [1748009585.087156] Press ctrl-t q to quit
 [1748009585.087683] Connected to /dev/ttyUSB0
This commit is contained in:
Maximilian Seesslen 2025-05-23 16:14:16 +02:00 committed by Martin Lund
parent 2fb788f817
commit 7e61a34df3
8 changed files with 28 additions and 5 deletions

View file

@ -400,6 +400,10 @@ const char* option_timestamp_format_to_string(timestamp_t timestamp)
return "epoch";
break;
case TIMESTAMP_EPOCH_USEC:
return "epoch-usec";
break;
default:
return "unknown";
break;
@ -430,6 +434,10 @@ void option_parse_timestamp(const char *arg, timestamp_t *timestamp)
{
*timestamp = TIMESTAMP_EPOCH;
}
else if (strcmp(arg, "epoch-usec") == 0)
{
*timestamp = TIMESTAMP_EPOCH_USEC;
}
else
{
tio_error_print("Invalid timestamp '%s'", arg);