static time_t
datestr2timestamp(const char *date)
{
- if (!date)
- return 0;
+ const char *p;
+ struct tm tm;
- if (strlen(date) == strspn(date, "0123456789"))
+ if (!date || !*date)
+ return 0;
+ for (p = date; *p >= '0' && *p <= '9'; p++)
+ ;
+ if (!*p)
return atoi(date);
-
- struct tm tm;
memset(&tm, 0, sizeof(tm));
if (!strptime(date, "%F%T", &tm))
return 0;
}
if (date)
{
- repodata_set_num(pd->data, pd->datanum, SOLVABLE_BUILDTIME, datestr2timestamp(date));
+ time_t t = datestr2timestamp(date);
+ if (t)
+ repodata_set_num(pd->data, pd->datanum, SOLVABLE_BUILDTIME, t);
}
}
break;