1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Use sscanf instead of strptime.

strptime isn't on Windows.
This commit is contained in:
david
2011-12-19 23:31:00 +00:00
parent 11f76fc189
commit bff7bf50f1

View File

@@ -591,9 +591,13 @@ static int parse_date(const char *s, time_t *t)
{
struct tm tm = {0};
if (strptime(s, "%Y-%d-%m", &tm) == NULL)
if (sscanf(s, "%d-%d-%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3)
return -1;
tm.tm_year -= 1900;
tm.tm_mon -= 1;
*t = mktime(&tm);
if (*t == -1)
return -1;
return 0;
}