diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/subr_msgbuf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/subr_msgbuf.c b/sys/kern/subr_msgbuf.c index b41e78dd886e..4664e742c5fb 100644 --- a/sys/kern/subr_msgbuf.c +++ b/sys/kern/subr_msgbuf.c @@ -234,8 +234,16 @@ msgbuf_addstr(struct msgbuf *mbp, int pri, const char *str, int filter_cr) if (msgbuf_show_timestamp && needtime == 1 && (mbp->msg_flags & MSGBUF_NEEDNL) == 0) { - snprintf(buf, sizeof(buf), "[%jd] ", - (intmax_t)time_uptime); + if (msgbuf_show_timestamp == 1) { + snprintf(buf, sizeof(buf), "[%jd] ", + (intmax_t)time_uptime); + } else { + struct timeval tv; + + microuptime(&tv); + snprintf(buf, sizeof(buf), "[%jd.%06d] ", + (intmax_t)tv.tv_sec, (int)tv.tv_usec); + } for (j = 0; buf[j] != '\0'; j++) msgbuf_do_addchar(mbp, buf[j]); needtime = 0; |
