Skip to content

Commit f80114a

Browse files
rainerjungFelipe Zimmerle
authored andcommitted
Add microsec timestamp resolution to the formatted log timestamp.
1 parent 40b9897 commit f80114a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

apache2/msc_util.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,10 +1129,12 @@ char *current_logtime(apr_pool_t *mp) {
11291129
char tstr[100];
11301130
apr_size_t len;
11311131

1132-
apr_time_exp_lt(&t, apr_time_now());
1132+
apr_time_t now = apr_time_now();
1133+
apr_time_exp_lt(&t, now);
11331134

1134-
apr_strftime(tstr, &len, 80, "%d/%b/%Y:%H:%M:%S ", &t);
1135-
apr_snprintf(tstr + strlen(tstr), 80 - strlen(tstr), "%c%.2d%.2d",
1135+
apr_strftime(tstr, &len, 80, "%d/%b/%Y:%H:%M:%S.", &t);
1136+
apr_snprintf(tstr + strlen(tstr), 80 - strlen(tstr), "%06ld %c%.2d%.2d",
1137+
((long)now) % 1000000L,
11361138
t.tm_gmtoff < 0 ? '-' : '+',
11371139
t.tm_gmtoff / (60 * 60), (t.tm_gmtoff / 60) % 60);
11381140
return apr_pstrdup(mp, tstr);

0 commit comments

Comments
 (0)