diff options
Diffstat (limited to '')
-rw-r--r-- | parse.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/parse.c b/parse.c index 6f1a56b..8d3205d 100644 --- a/parse.c +++ b/parse.c @@ -66,21 +66,20 @@ void parseEnvelope(struct Envelope *envelope, struct List list) { errx(EX_PROTOCOL, "missing envelope structure fields"); } + struct tm tm; const char *date = dataCheck(list.ptr[Date], String).string; if (isalpha(date[0])) { - date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &envelope->date); + date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &tm); } else { - date = strptime(date, "%e %b %Y %H:%M:%S ", &envelope->date); + date = strptime(date, "%e %b %Y %H:%M:%S ", &tm); } if (date && (date[0] == '+' || date[0] == '-')) { - date = strptime(date, "%z", &envelope->date); + date = strptime(date, "%z", &tm); } else if (date) { - date = strptime(date, "%Z", &envelope->date); + date = strptime(date, "%Z", &tm); } if (!date) errx(EX_PROTOCOL, "invalid envelope date format"); - - envelope->date.tm_isdst = -1; - envelope->utc = mktime(&envelope->date); + envelope->date = mktime(&tm); // TODO: Decode UTF-8 in subject. envelope->subject = strdup(dataCheck(list.ptr[Subject], String).string); |