static char *
time_for_ttx(void)
{
+ static char timestr[25];
+ size_t timestrlen;
struct tm *timeptr, tm;
unsigned long long epochull;
- char *epochstr, *endptr, *timestr;
+ char *epochstr, *endptr;
/* Work out what timestamp to use. */
if ((epochstr = getenv("SOURCE_DATE_EPOCH")) != NULL) {
return NULL;
}
}
- timestr = asctime(timeptr);
- assert(strlen(timestr) == 25);
- timestr[24] = '\0'; /* Remove newline. */
+ timestrlen = strftime(timestr, lenof(timestr), "%c", timeptr);
+ assert(timestrlen == 24);
return timestr;
}