xiaoxiang781216 commented on a change in pull request #2621: URL: https://github.com/apache/incubator-nuttx/pull/2621#discussion_r555852824
########## File path: drivers/syslog/vsyslog.c ########## @@ -132,8 +137,25 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap) #if defined(CONFIG_SYSLOG_TIMESTAMP) /* Pre-pend the message with the current time, if available */ +#if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED) + time = ts.tv_sec; +#if defined(CONFIG_SYSLOG_TIMESTAMP_LOCALTIME) + localtime_r(&time, &tm); +#else + gmtime_r(&time, &tm); +#endif + + ret = strftime(date_buf, CONFIG_SYSLOG_TIMESTAMP_BUFFER, + CONFIG_SYSLOG_TIMESTAMP_FORMAT, &tm); + + if (ret > 0) + { + ret = lib_sprintf(&stream.public, "[%s] ", date_buf); Review comment: should we output nanosecond? otherwise, the precision is too low. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org