diff options
Diffstat (limited to '')
-rw-r--r-- | parse.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/parse.c b/parse.c index 33acd5b..6f1a56b 100644 --- a/parse.c +++ b/parse.c @@ -14,6 +14,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +#include <ctype.h> #include <err.h> #include <stdio.h> #include <stdlib.h> @@ -66,7 +67,16 @@ void parseEnvelope(struct Envelope *envelope, struct List list) { } const char *date = dataCheck(list.ptr[Date], String).string; - date = strptime(date, "%a, %e %b %Y %H:%M:%S %z", &envelope->date); + if (isalpha(date[0])) { + date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &envelope->date); + } else { + date = strptime(date, "%e %b %Y %H:%M:%S ", &envelope->date); + } + if (date && (date[0] == '+' || date[0] == '-')) { + date = strptime(date, "%z", &envelope->date); + } else if (date) { + date = strptime(date, "%Z", &envelope->date); + } if (!date) errx(EX_PROTOCOL, "invalid envelope date format"); envelope->date.tm_isdst = -1; |