--- usr.sbin/syslogd/syslogd.c 2012-11-12 10:16:53.001010772 +0100 +++ usr.sbin/syslogd/syslogd.c.new 2013-01-02 15:44:49.912466471 +0100 @@ -184,7 +184,7 @@ } f_pipe; } f_un; char f_prevline[MAXSVLINE]; /* last message logged */ - char f_lasttime[16]; /* time of last occurrence */ + char f_lasttime[20]; /* time of last occurrence */ char f_prevhost[MAXHOSTNAMELEN]; /* host from which recd. */ int f_prevpri; /* pri of f_prevline */ int f_prevlen; /* length of f_prevline */ @@ -911,6 +911,7 @@ const char *timestamp; char prog[NAME_MAX+1]; char buf[MAXLINE+1]; + char nonstdtimestamp[sizeof("2013-01-01 15:23:00")]; dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg); @@ -934,6 +935,9 @@ msglen -= 16; } + (void)strftime(nonstdtimestamp, sizeof(nonstdtimestamp), + "%Y-%m-%d %H:%M:%S", localtime(&now)); + /* skip leading blanks */ while (isspace(*msg)) { msg++; @@ -1043,8 +1047,13 @@ fprintlog(f, 0, (char *)NULL); f->f_repeatcount = 0; f->f_prevpri = pri; - (void)strlcpy(f->f_lasttime, timestamp, - sizeof(f->f_lasttime)); + if (f->f_type == F_PIPE || f->f_type == F_FILE) { + (void)strlcpy(f->f_lasttime, nonstdtimestamp, + sizeof(f->f_lasttime)); + } else { + (void)strlcpy(f->f_lasttime, timestamp, + sizeof(f->f_lasttime)); + } (void)strlcpy(f->f_prevhost, from, sizeof(f->f_prevhost)); if (msglen < MAXSVLINE) {