[Bug 2464] Adding timestamp to debug messages (log.c:do_log)

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Thu Oct 29 11:26:31 AEDT 2015


--- Comment #2 from Darren Tucker <dtucker at zip.com.au> ---
Comment on attachment 2740
  --> https://bugzilla.mindrot.org/attachment.cgi?id=2740
adding timestamp to debug messages

>+#include <sys/timeb.h>

style(9) says this should go with the other <sys/...> includes. 

>+		ftime (&tb);

ftime is obsolete and has been removed from POSIX.1-2008.  Should use
gettimeofday instead.

>+		localtime_r (&tb.time, &tm);
>+		p += strftime (p, 16, "%Y%m%d.%H%M%S", &tm);

I'm not a fan of unnecessary pointer arithmetic.  Since this is neither
time nor space critical, I'd rather strftime into a static buffer then
use snprintf to assemble the final string.

>+		p += sprintf (p, ".%03d ", tb.millitm);

also not a fan of unbounded string functions even if this particular
one is safe.

You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.

More information about the openssh-bugs mailing list