case 'T':
{
time_t t;
- struct tm *lt;
const char *tstring;
- char buffer[sizeof("Www Mmm dd hh:mm:ss yyyy\n")];
+ char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy")];
uint32_t x;
switch (atoi(fmt + 1)) {
break;
}
if (t != 0) {
- lt = localtime(&t);
- if (lt != NULL) {
- strftime(buffer, sizeof(buffer), "%a %b %e %T %Y%n", lt);
- tstring = buffer;
- }
- else
- tstring = "(Can't convert time)\n";
+ tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y",
+ localtime(&t));
} else
- tstring = "NULL\n";
- ND_PRINT("%s", tstring);
+ tstring = "NULL";
+ ND_PRINT("%s\n", tstring);
fmt++;
while (ND_ASCII_ISDIGIT(*fmt))
fmt++;