about summary refs log tree commit diff
path: root/parse.c
diff options
context:
space:
mode:
authorC. McEnroe <june@causal.agency>2020-04-13 12:43:56 -0400
committerC. McEnroe <june@causal.agency>2020-04-13 12:43:56 -0400
commitd031cf5f00de4bf6b33396f1a448833a6de33c5f (patch)
treeaa80e5cda92bfc2d3338f7020a8ab75ca1369cf5 /parse.c
parentRework path functions again (diff)
downloadbubger-d031cf5f00de4bf6b33396f1a448833a6de33c5f.tar.gz
bubger-d031cf5f00de4bf6b33396f1a448833a6de33c5f.zip
Use UTC date everywhere
I thought I could preserve the original time zone but it turns out that
libc is just too shit to do that.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c13
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);