Skip to content

Commit 7646fc5

Browse files
committed
Shortened timestamp.
1 parent fa49b6a commit 7646fc5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: src/eotd.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,14 @@ void eotd_to_text (unsigned char *eotd, int eotd_len, char *text, int text_size)
250250
}
251251

252252
#ifdef EOTD_TIMESTAMP
253-
time_t now = time(NULL);
254-
strlcat(text, "timestamp=", text_size);
255-
strlcat(text, ctime(&now), text_size);
256-
text[strlen(text) -1] = ','; // zap lf
253+
time_t t = time(NULL);
254+
struct tm *now = localtime(&t);
255+
char date_buffer[32];
256+
strlcat(text, "ts=", text_size);
257+
sprintf(date_buffer, "%d-%02d-%02dT%02d:%02d:%02d,",
258+
now->tm_year + 1900, now->tm_mon + 1, now->tm_mday,
259+
now->tm_hour, now->tm_min, now->tm_sec);
260+
strlcat(text, date_buffer, text_size);
257261
#endif
258262
get_chain(pkt, text, text_size);
259263
add_comma(text, text_size);

0 commit comments

Comments
 (0)