From 7c45b15da28ef8a95a3a886594b3c74abd15faa1 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@fe.uni-lj.si> Date: Thu, 10 Mar 2016 08:28:31 +0000 Subject: [PATCH] Some local changes --- src/general.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/general.c b/src/general.c index b078f87..1ada40d 100644 --- a/src/general.c +++ b/src/general.c @@ -1,11 +1,24 @@ +/* vim: set ts=4 sts=4 sw=4 noet : */ #include<stdio.h> #include<stdlib.h> #include "general.h" #include<stdarg.h> -ts_uint ts_fprintf(FILE *fd, char *fmt, va_list ap){ +#include <sys/time.h> +#include <unistd.h> +#include <time.h> + + +ts_uint ts_fprintf(FILE *fd, char *fmt, ...){ if(quiet) return TS_SUCCESS; -fprintf(fd, fmt, ap); /* Call vprintf */ + va_list ap; + va_start(ap,fmt); + char tmbuf[255]; + struct timeval now; + gettimeofday(&now, 0); + strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", localtime(&now.tv_sec)); +fprintf(fd, "[%s] ",tmbuf); +vfprintf(fd, fmt, ap); /* Call vfprintf */ va_end(ap); /* Cleanup the va_list */ return TS_SUCCESS; } -- Gitblit v1.9.3