From bff7bf50f16df93313366cd48d845a6c90e63753 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 19 Dec 2011 23:31:00 +0000 Subject: [PATCH] Use sscanf instead of strptime. strptime isn't on Windows. --- nmap-update/nmap-update.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nmap-update/nmap-update.c b/nmap-update/nmap-update.c index 07f0cb3c1..2e2a0844e 100644 --- a/nmap-update/nmap-update.c +++ b/nmap-update/nmap-update.c @@ -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; }