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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user