mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
Use sscanf instead of strptime.
strptime isn't on Windows.
This commit is contained in:
parent
11f76fc189
commit
bff7bf50f1
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue