repostead

static page generator for VCS repositories

git clone https://www.shemshak.org/~amin/repostead


diff --git a/repostead.c b/repostead.c
index 12bbcd6..a8181ab 100644
--- a/repostead.c
+++ b/repostead.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <git2.h>
@@ -965,6 +966,18 @@ process_commits(const struct repostead_config *conf,
 			const git_signature *author = git_commit_author(c);
 
 			fputs("<tr class=\"commit\">", index_file);
+			if (author) {
+				struct tm tm;
+				char tbuf[11];
+				git_time_t sec = author->when.time;
+				int off = author->when.offset;
+				time_t t = (time_t)(sec + (git_time_t)off * 60);
+				gmtime_r(&t, &tm);
+				strftime(tbuf, sizeof(tbuf), "%Y-%m-%d", &tm);
+				fputs("<td class=\"date\">", index_file);
+				fputs(tbuf, index_file);
+				fputs("</td>", index_file);
+			}
 			fputs("<td class=\"summary\">", index_file);
 			html_esc(index_file, summary ? summary : "(no message)");
 			fputs("</td>", index_file);