diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-03 13:57:05 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-03 13:57:05 +0100 |
commit | c747bf2722f091b26af672db87e844f1dc833c12 (patch) | |
tree | 5201e0f55dcc86ca9c8541b34eb6e608cbf539a1 | |
parent | 861d7e09fa120cc20f36254f6aeb77228fefce9f (diff) |
sfeed: fix set offset on success
-rw-r--r-- | sfeed.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -322,7 +322,7 @@ gettimetz(const char *s, char *buf, size_t bufsiz, int *tzoffset) if(isalpha((int)*p)) { if(*p == 'Z' || *p == 'z') { strlcpy(buf, "GMT+0000", bufsiz); - return 0; + goto time_ok; } else { for(i = 0, t = &tzname[0]; i < (sizeof(tzname) - 1) && (*p && isalpha((int)*p)); i++) @@ -334,7 +334,7 @@ gettimetz(const char *s, char *buf, size_t bufsiz, int *tzoffset) } if(!(*p)) { strlcpy(buf, tzname, bufsiz); - return 0; + goto time_ok; } if((sscanf(p, "%c%02d:%02d", &c, &tzhour, &tzmin)) > 0) ; @@ -343,6 +343,7 @@ gettimetz(const char *s, char *buf, size_t bufsiz, int *tzoffset) else if(sscanf(p, "%c%d", &c, &tzhour) > 0) tzmin = 0; snprintf(buf, bufsiz, "%s%c%02d%02d", tzname, c, tzhour, tzmin); +time_ok: /* TODO: test + or - offset */ if(tzoffset) *tzoffset = (tzhour * 3600) + (tzmin * 60) * (c == '-' ? -1 : 1); |