From 7646fc57483c47f9668df213bafab09c7a1fd2ec Mon Sep 17 00:00:00 2001 From: "David E. Tiller" <3858971+dtiller@users.noreply.github.com> Date: Mon, 4 Apr 2022 19:20:01 -0400 Subject: [PATCH] Shortened timestamp. --- src/eotd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/eotd.c b/src/eotd.c index e87b46b..b48cc0a 100644 --- a/src/eotd.c +++ b/src/eotd.c @@ -250,10 +250,14 @@ void eotd_to_text (unsigned char *eotd, int eotd_len, char *text, int text_size) } #ifdef EOTD_TIMESTAMP - time_t now = time(NULL); - strlcat(text, "timestamp=", text_size); - strlcat(text, ctime(&now), text_size); - text[strlen(text) -1] = ','; // zap lf + time_t t = time(NULL); + struct tm *now = localtime(&t); + char date_buffer[32]; + 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 get_chain(pkt, text, text_size); add_comma(text, text_size);