diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-03 17:19:21 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-03 17:19:21 +0100 |
commit | 7c220b7102082d975ef0c901e1beb76040e33b7a (patch) | |
tree | 0950b69b9198ea496775b46eb180c24b0f7806af | |
parent | 84266bd4447a8f66e77f4179d7f1cdc6d2012258 (diff) |
sfeed: remove level of indent in parsetime
-rw-r--r-- | sfeed.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -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; } |