summaryrefslogtreecommitdiff
path: root/debug.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-11-02 14:08:39 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-11-02 14:08:39 +0100
commit2f6d64ad096817a13c90af63f3cfd229e9b42122 (patch)
treea56fe5419dc98c2df35c2ee4f9cdc39210a99ca5 /debug.cc
parentb1d8896cbac3c283bb5c0a724f7e9f28623fbf82 (diff)
New date format.
Diffstat (limited to 'debug.cc')
-rw-r--r--debug.cc14
1 files 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);