]> granicus.if.org Git - pgbouncer/commitdiff
add milliseconds to log timestamps
authorMarko Kreen <markokr@gmail.com>
Wed, 19 Nov 2008 12:10:50 +0000 (12:10 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 19 Nov 2008 12:10:50 +0000 (12:10 +0000)
src/util.c

index 937879dc145f0e178007520f0f3cd5ce03014440..0ba6e56d75682fc4b9d7a8b063c462ab893fe400 100644 (file)
@@ -67,7 +67,10 @@ static void render_time(char *buf, int max)
        struct timeval tv;
        gettimeofday(&tv, NULL);
        localtime_r(&tv.tv_sec, &tm);
-       strftime(buf, max, "%Y-%m-%d %H:%M:%S", &tm);
+       snprintf(buf, max, "%04d-%02d-%02d %02d:%02d:%02d.%03d",
+                tm.tm_year, tm.tm_mon, tm.tm_mday,
+                tm.tm_hour, tm.tm_min, tm.tm_sec,
+                (int)(tv.tv_usec / 1000));
 }
 
 static void close_syslog(void)