mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +02:00
Reintroduce long timestamp format
But make the timestamp format RFC3339 compliant instead. The RFC states:
NOTE: ISO 8601 defines date and time separated by "T".
Applications using this syntax may choose, for the sake of
readability, to specify a full-date and full-time separated by
(say) a space character.
This way we keep the information specified by ISO 8601 but make it more
human readable which is better for the console output.
This commit is contained in:
parent
32113076d6
commit
883e3b0bea
1 changed files with 3 additions and 3 deletions
|
|
@ -28,8 +28,8 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
|
||||||
// "hh:mm:ss.sss"
|
// "YYYY-MM-DD hh:mm:ss.sss" (ISO-8601/RFC3339 format)
|
||||||
#define TIME_STRING_SIZE 15
|
#define TIME_STRING_SIZE 24
|
||||||
|
|
||||||
char * current_time(void)
|
char * current_time(void)
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +46,7 @@ char * current_time(void)
|
||||||
exit(EXIT_FAILURE);
|
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-%d %H:%M:%S", tmp);
|
||||||
if (len) {
|
if (len) {
|
||||||
len = snprintf(time_string + len, TIME_STRING_SIZE - len, ".%03ld", (long)tv.tv_usec / 1000);
|
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