mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add "epoch" timestamp option
Add an option that prints the timestamp as the number of seconds since the Unix epoch.
This commit is contained in:
parent
cdc773100c
commit
f47467271f
6 changed files with 23 additions and 1 deletions
|
|
@ -76,6 +76,12 @@ char *timestamp_current_time(void)
|
|||
tm = localtime(&tv.tv_sec);
|
||||
len = strftime(time_string, sizeof(time_string), "%Y-%m-%dT%H:%M:%S", tm);
|
||||
break;
|
||||
case TIMESTAMP_EPOCH:
|
||||
// "1223" (seconds since Unix epoch, 1970-01-01 00:00:00Z)
|
||||
tv = tv_now;
|
||||
tm = localtime(&tv.tv_sec);
|
||||
len = strftime(time_string, sizeof(time_string), "%s", tm);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue