diff smpp-trx-sa/log.c @ 261:a375639e4190

smpp-trx-sa: refactor time formatting code
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 11 Oct 2023 17:34:45 -0800
parents 9d6e8d99d2b1
children f1c024b2b835
line wrap: on
line diff
--- a/smpp-trx-sa/log.c	Tue Aug 15 23:23:57 2023 -0800
+++ b/smpp-trx-sa/log.c	Wed Oct 11 17:34:45 2023 -0800
@@ -11,28 +11,15 @@
 
 extern FILE *logF;
 extern time_t curtime;
+extern char fmt_time[32];
 extern int init_done;
 
-static char fmt_time[32];
-
-static void
-format_time()
-{
-	struct tm *tm;
-
-	tm = gmtime(&curtime);
-	sprintf(fmt_time, "%d-%02d-%02dT%02d:%02d:%02dZ",
-		tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-		tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
 void
 log_fatal_error(cause)
 	char *cause;
 {
 	if (!init_done)
 		return;
-	format_time();
 	fprintf(logF, "\n%s %s\n", fmt_time, cause);
 }
 
@@ -72,7 +59,6 @@
 	u_char *pdu;
 	unsigned pdulen;
 {
-	format_time();
 	fprintf(logF, "\n%s Received PDU:\n", fmt_time);
 	pdu_hexdump(pdu, pdulen);
 }
@@ -82,7 +68,6 @@
 	u_char *pdu;
 	unsigned pdulen;
 {
-	format_time();
 	fprintf(logF, "\n%s Sent PDU:\n", fmt_time);
 	pdu_hexdump(pdu, pdulen);
 }