Add microsec timestamp resolution to the formatted log timestamp.

This commit is contained in:
Rainer Jung 2019-05-15 01:50:20 +02:00 committed by Felipe Zimmerle
parent 40b98970c4
commit f80114a906
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -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);