From 2f6d64ad096817a13c90af63f3cfd229e9b42122 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 2 Nov 2012 14:08:39 +0100 Subject: New date format. --- debug.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/debug.cc b/debug.cc index 4776c62..ed0ac84 100644 --- a/debug.cc +++ b/debug.cc @@ -77,15 +77,21 @@ int __debug(const char *func, const int line, const char *ch, const char *fmt, ...) { time_t rawtime = time(NULL); - char* timestr = ctime(&rawtime); - *(timestr+strlen(timestr)-1) = '\0'; + struct tm *t = localtime(&rawtime); // MutexAutolock m(mutex); int ret = 0; if(__debug_enabled(cl, ch)) { if((unsigned)cl < NELEM(debug_class_str)) - ret += fprintf(logfp, "[%s] %u %s:%s:%s:%d ", - timestr, gettid(), debug_class_str[(unsigned)cl], ch, func, line); + ret += fprintf(logfp, "%d-%02d-%02d %02d:%02d:%02d %u %s:%s:%s:%d ", + t->tm_year + 1900, + t->tm_mon + 1, + t->tm_mday, + t->tm_hour, + t->tm_min, + t->tm_sec, + gettid(), + debug_class_str[(unsigned)cl], ch, func, line); if(fmt) { va_list va; va_start(va, fmt); -- cgit v1.2.3