mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Change timestamp format to ISO-8601.
This commit is contained in:
parent
c216f3e979
commit
016bcf99ba
1 changed files with 3 additions and 2 deletions
|
|
@ -28,7 +28,8 @@
|
|||
#include "tio/error.h"
|
||||
#include "tio/print.h"
|
||||
|
||||
#define TIME_STRING_SIZE 20
|
||||
// "YYYY-MM-DDThh:mm:ss.sss" (ISO-8601 format).
|
||||
#define TIME_STRING_SIZE 24
|
||||
|
||||
char * current_time(void)
|
||||
{
|
||||
|
|
@ -45,7 +46,7 @@ char * current_time(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
size_t len = strftime(time_string, sizeof(time_string), "%H:%M:%S", tmp);
|
||||
size_t len = strftime(time_string, sizeof(time_string), "%Y-%m-%dT%H:%M:%S", tmp);
|
||||
if (len) {
|
||||
len = snprintf(time_string + len, TIME_STRING_SIZE - len, ".%03ld", (long)tv.tv_usec / 1000);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue