add timestamp to debug outputs

merge-requests/228/head
Rolf Bensch 2019-10-19 22:00:35 +02:00
rodzic 3dff8085e7
commit d9f35d1b5e
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -58,6 +58,8 @@
#include <sys/socket.h>
#endif
#include <sys/stat.h>
#include <time.h>
#include <sys/time.h>
#ifdef HAVE_OS2_H
# define INCL_DOS
@ -148,7 +150,13 @@ sanei_debug_msg
}
else
{
fprintf (stderr, "[%s] ", be);
struct timeval tv;
struct tm *t;
gettimeofday (&tv, NULL);
t = localtime (&tv.tv_sec);
fprintf (stderr, "[%02d:%02d:%02d] [%s] ", t->tm_hour, t->tm_min, t->tm_sec, be);
vfprintf (stderr, fmt, ap);
}