summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c3
-rw-r--r--archive.h1
-rw-r--r--html.c9
3 files changed, 13 insertions, 0 deletions
diff --git a/archive.c b/archive.c
index fd8ef53..ca56c8c 100644
--- a/archive.c
+++ b/archive.c
@@ -142,6 +142,9 @@ static struct Envelope parseEnvelope(struct List list) {
 	date = strptime(date, "%a, %e %b %Y %H:%M:%S %z", &envelope.date);
 	if (!date) errx(EX_PROTOCOL, "invalid envelope date format");
 
+	envelope.date.tm_isdst = -1;
+	envelope.utc = mktime(&envelope.date);
+
 	if (list.ptr[Subject].type != String) {
 		errx(EX_PROTOCOL, "invalid envelope subject field");
 	}
diff --git a/archive.h b/archive.h
index 3d3cfc5..6cc7c5f 100644
--- a/archive.h
+++ b/archive.h
@@ -30,6 +30,7 @@ struct AddressList {
 };
 
 struct Envelope {
+	time_t utc;
 	struct tm date;
 	char *subject;
 	struct Address from, sender, replyTo;
diff --git a/html.c b/html.c
index 50a8378..3ebf9c3 100644
--- a/html.c
+++ b/html.c
@@ -35,6 +35,7 @@ static const char *Envelope = TEMPLATE(
 		<address>
 			<a href="[mailto]">[from]</a>
 		</address>
+		<time datetime="[utc]">[date]</time>
 	</summary>
 );
 
@@ -66,11 +67,19 @@ int htmlEnvelope(FILE *file, const struct Envelope *envelope) {
 	const char *from = envelope->from.name;
 	if (!from) from = envelope->from.mailbox;
 
+	char utc[sizeof("0000-00-00T00:00:00Z")];
+	strftime(utc, sizeof(utc), "%FT%TZ", gmtime(&envelope->utc));
+
+	char date[256];
+	strftime(date, sizeof(date), "%c %z", &envelope->date);
+
 	struct Variable vars[] = {
 		{ "messageID", envelope->messageID },
 		{ "subject", envelope->subject },
 		{ "mailto", mailto },
 		{ "from", from },
+		{ "utc", utc },
+		{ "date", date },
 		{0},
 	};
 	error = templateRender(file, Envelope, vars, escapeXML);
June McEnroe 2012-01-22Use space-test branch of quicktaskJune McEnroe 2012-01-22Enable syntax-based foldingJune McEnroe 2012-01-22Update quicktaskJune McEnroe 2012-01-22Revert "Add AutoClose"June McEnroe This reverts commit 39cfdd62ba82f93f68a2b5fa7b5771303d8b9dee. This fixes the delay when leaving insert mode 2012-01-22Revert "Disable powerline for now"June McEnroe This reverts commit fa48f5965c57272e616721d92475cd2f1e35f667. 2012-01-22Revert "Add VCS repo directories to wildignore"June McEnroe This reverts commit 41cb1db33ba7b64d8af63bf55bb82f7e8a617518. This fixes not being able to commit with vim-fugitive 2012-01-22Disable powerline for nowJune McEnroe 2012-01-22Update some pluginsJune McEnroe 2012-01-22Add VCS repo directories to wildignoreJune McEnroe 2012-01-22Map ,e and ,b to CtrlP file and buffer respectivelyJune McEnroe 2012-01-22Add vim-spaceJune McEnroe 2012-01-22Add AutoCloseJune McEnroe 2012-01-22Add binding for GundoJune McEnroe 2012-01-22Add GundoJune McEnroe 2012-01-22Add Jellybeans colorschemeJune McEnroe 2012-01-22Add syntasticJune McEnroe 2012-01-21Add PowerlineJune McEnroe 2012-01-21Add quicktaskJune McEnroe 2012-01-15Moved comments out of mapsJune McEnroe 2012-01-14Disable scrollbarsJune McEnroe