From 31ccad209a9608cdecc9a5cb10f14a4cf2fb5b97 Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Wed, 15 May 2019 01:50:20 +0200 Subject: [PATCH] Add microsec timestamp resolution to the formatted log timestamp. --- apache2/msc_util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apache2/msc_util.c b/apache2/msc_util.c index 7a95e078dc..2fdfd57c32 100644 --- a/apache2/msc_util.c +++ b/apache2/msc_util.c @@ -1129,10 +1129,12 @@ char *current_logtime(apr_pool_t *mp) { char tstr[100]; apr_size_t len; - apr_time_exp_lt(&t, apr_time_now()); + apr_time_t now = apr_time_now(); + apr_time_exp_lt(&t, now); - apr_strftime(tstr, &len, 80, "%d/%b/%Y:%H:%M:%S ", &t); - apr_snprintf(tstr + strlen(tstr), 80 - strlen(tstr), "%c%.2d%.2d", + apr_strftime(tstr, &len, 80, "%d/%b/%Y:%H:%M:%S.", &t); + apr_snprintf(tstr + strlen(tstr), 80 - strlen(tstr), "%06ld %c%.2d%.2d", + ((long)now) % 1000000L, t.tm_gmtoff < 0 ? '-' : '+', t.tm_gmtoff / (60 * 60), (t.tm_gmtoff / 60) % 60); return apr_pstrdup(mp, tstr);