|
|
@ -1572,7 +1572,6 @@ static void _txt_to_double(char *nam, char *fld, double *data, size_t siz, WHERE |
|
|
|
static char *_data_to_buf(enum data_type typ, void *data, char *buf, size_t siz, WHERE_FFL_ARGS) |
|
|
|
static char *_data_to_buf(enum data_type typ, void *data, char *buf, size_t siz, WHERE_FFL_ARGS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct tm tm; |
|
|
|
struct tm tm; |
|
|
|
char *buf2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!buf) { |
|
|
|
if (!buf) { |
|
|
|
switch (typ) { |
|
|
|
switch (typ) { |
|
|
@ -1619,16 +1618,15 @@ static char *_data_to_buf(enum data_type typ, void *data, char *buf, size_t siz, |
|
|
|
snprintf(buf, siz, "%"PRId32, *((uint32_t *)data)); |
|
|
|
snprintf(buf, siz, "%"PRId32, *((uint32_t *)data)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TYPE_TV: |
|
|
|
case TYPE_TV: |
|
|
|
buf2 = malloc(siz); |
|
|
|
gmtime_r(&(((struct timeval *)data)->tv_sec), &tm); |
|
|
|
if (!buf2) { |
|
|
|
snprintf(buf, siz, "%d-%02d-%02d %02d:%02d:%02d.%06ld+00", |
|
|
|
quithere(1, "OOM (%d)" WHERE_FFL, |
|
|
|
tm.tm_year + 1900, |
|
|
|
(int)siz, WHERE_FFL_PASS); |
|
|
|
tm.tm_mon + 1, |
|
|
|
} |
|
|
|
tm.tm_mday, |
|
|
|
localtime_r(&(((struct timeval *)data)->tv_sec), &tm); |
|
|
|
tm.tm_hour, |
|
|
|
strftime(buf2, siz, "%Y-%m-%d %H:%M:%S", &tm); |
|
|
|
tm.tm_min, |
|
|
|
snprintf(buf, siz, "%s.%06ld", buf2, |
|
|
|
tm.tm_sec, |
|
|
|
(((struct timeval *)data)->tv_usec)); |
|
|
|
(((struct timeval *)data)->tv_usec)); |
|
|
|
free(buf2); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case TYPE_CTV: |
|
|
|
case TYPE_CTV: |
|
|
|
snprintf(buf, siz, "%ld,%ld", |
|
|
|
snprintf(buf, siz, "%ld,%ld", |
|
|
|