From c4691306c40dedc61110174dde15310c359abb6a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 24 Oct 2011 13:42:36 -0700 Subject: [PATCH] Avoid using strptime It's less portable (missing on Windows, for example) and it's kind of overkill here - the same is easily done with a sscanf. Signed-off-by: Dirk Hohndel --- parse-xml.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parse-xml.c b/parse-xml.c index 1b0c449..c44b6f6 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -783,8 +783,14 @@ static void uemis_ts(char *buffer, void *_when) struct tm tm; time_t *when = _when; - strptime(buffer, "%Y-%m-%dT%H:%M:%S", &tm); + memset(&tm, 0, sizeof(tm)); + sscanf(buffer,"%d-%d-%dT%d:%d:%d", + &tm.tm_year, &tm.tm_mon, &tm.tm_mday, + &tm.tm_hour, &tm.tm_min, &tm.tm_sec); + tm.tm_mon -= 1; + tm.tm_year -= 1900; *when = utc_mktime(&tm); + } static void uemis_duration(char *buffer, void *_duration) -- 2.43.0