Commit 2eb0d4c9 authored by Cedric Roux's avatar Cedric Roux

add time to textlog if available

parent df5afaa9
...@@ -37,9 +37,21 @@ static void _event(void *p, event e) ...@@ -37,9 +37,21 @@ static void _event(void *p, event e)
{ {
struct textlog *l = p; struct textlog *l = p;
int i; int i;
#ifdef T_SEND_TIME
struct tm *t;
char tt[64];
#endif
l->o.osize = 0; l->o.osize = 0;
#ifdef T_SEND_TIME
t = localtime(&e.sending_time.tv_sec);
/* round tv_nsec to nearest millisecond */
sprintf(tt, "%2.2d:%2.2d:%2.2d.%3.3d: ", t->tm_hour, t->tm_min, t->tm_sec,
(int)((e.sending_time.tv_nsec/(1000000/2)+1)/2));
PUTS(&l->o, tt);
#endif
for (i = 0; i < l->fsize; i++) for (i = 0; i < l->fsize; i++)
switch(l->f[i].type) { switch(l->f[i].type) {
case INSTRING: PUTS(&l->o, l->f[i].s); break; case INSTRING: PUTS(&l->o, l->f[i].s); break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment