Shortened timestamp.

This commit is contained in:
David E. Tiller 2022-04-04 19:20:01 -04:00
parent fa49b6a40b
commit 7646fc5748
1 changed files with 8 additions and 4 deletions

View File

@ -250,10 +250,14 @@ void eotd_to_text (unsigned char *eotd, int eotd_len, char *text, int text_size)
} }
#ifdef EOTD_TIMESTAMP #ifdef EOTD_TIMESTAMP
time_t now = time(NULL); time_t t = time(NULL);
strlcat(text, "timestamp=", text_size); struct tm *now = localtime(&t);
strlcat(text, ctime(&now), text_size); char date_buffer[32];
text[strlen(text) -1] = ','; // zap lf strlcat(text, "ts=", text_size);
sprintf(date_buffer, "%d-%02d-%02dT%02d:%02d:%02d,",
now->tm_year + 1900, now->tm_mon + 1, now->tm_mday,
now->tm_hour, now->tm_min, now->tm_sec);
strlcat(text, date_buffer, text_size);
#endif #endif
get_chain(pkt, text, text_size); get_chain(pkt, text, text_size);
add_comma(text, text_size); add_comma(text, text_size);