This commit is contained in:
2023-09-05 09:09:55 +02:00
parent 773c8549f3
commit 4451879e35
7 changed files with 90 additions and 55 deletions

View File

@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <stdarg.h>
#include <pthread.h>
@@ -42,9 +43,9 @@ void static set_timestamp(char* buffer) {
clock_gettime(CLOCK_SOURCE, &tv);
memset(buffer, '\0', MAX_TS_LEN);
sprintf(buffer, "%04d-%02d-%02dT%02d:%02d:%02d.%ld+%s",
sprintf(buffer, "%04d-%02d-%02dT%02d:%02d:%02d.%03ld+%s",
ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour,
ptm->tm_min, ptm->tm_sec, tv.tv_nsec, ptm->tm_zone);
ptm->tm_min, ptm->tm_sec, tv.tv_nsec/(int64_t)1000000, ptm->tm_zone);
}
void log_error(const char* format, ...) {