From 7c220b7102082d975ef0c901e1beb76040e33b7a Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 3 Jan 2015 17:19:21 +0100 Subject: sfeed: remove level of indent in parsetime --- sfeed.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/sfeed.c b/sfeed.c index c60af7d..7426471 100644 --- a/sfeed.c +++ b/sfeed.c @@ -364,20 +364,21 @@ parsetime(const char *s, char *buf, size_t bufsiz, time_t *tp) memset(&tm, 0, sizeof(tm)); for(i = 0; formats[i]; i++) { - if((p = strptime(s, formats[i], &tm))) { - tm.tm_isdst = -1; /* don't use DST */ - if((t = mktime(&tm)) == -1) /* error */ - return -1; - if(gettimetz(p, tz, sizeof(tz), &tzoffset) != -1) - t -= tzoffset; - if(buf) - snprintf(buf, bufsiz, "%04d-%02d-%02d %02d:%02d:%02d %s", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec, tz); - if(tp) - *tp = t; - return 0; - } + if(!(p = strptime(s, formats[i], &tm))) + continue; + tm.tm_isdst = -1; /* don't use DST */ + if((t = mktime(&tm)) == -1) /* error */ + return -1; + if(gettimetz(p, tz, sizeof(tz), &tzoffset) != -1) + t -= tzoffset; + if(buf) + snprintf(buf, bufsiz, + "%04d-%02d-%02d %02d:%02d:%02d %s", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, tz); + if(tp) + *tp = t; + return 0; } return -1; } -- cgit v1.2.3