The buffer being hardcoded to 19 (the size expected from the default time format),
strftime() would fail on any format returning a longer buffer.
Changed it from 19 to 64 to accomodate longer formats.
get_datetime()
{
time_t tm;
get_datetime()
{
time_t tm;
char *buf = malloc(bufsize);
/* get time in format */
time(&tm);
if(!strftime(buf, bufsize, timeformat, localtime(&tm))) {
char *buf = malloc(bufsize);
/* get time in format */
time(&tm);
if(!strftime(buf, bufsize, timeformat, localtime(&tm))) {
- fprintf(stderr, "Strftime failed.\n");
+ fprintf(stderr, "Strftime failed.\n");