Download raw body.
gotwebd: replace strftime(3) with asctime_r(3)
As discussed with stsp on IRC, replace this instance of strftime in the patch page for consistency as asctime_r is used in all the other public dates in gotweb pages (e.g., diff, blame, tree) except for the rss feed, which uses the standard rfc822 format. tog, got, gotd, and cvg also use asctime_r. The two remaining strftime calls in gotweb's template engine are for the aforementioned rss feed and the html datetime attribute, which uses the standard rfc3339 format, so they should not be replaced. The diff also reverts the change to the gotweb patch test case as its date now conforms with the others. M gotwebd/pages.tmpl | 4+ 2- M regress/gotwebd/test_gotwebd.sh | 1+ 1- 2 files changed, 5 insertions(+), 3 deletions(-) path + /home/mark/src/got commit - 30935818050c098031758840ceaeb046cd533cf0 blob - 2594c09ca6c2732111ca27d0de6e45f927624dc7 file + gotwebd/pages.tmpl --- gotwebd/pages.tmpl +++ gotwebd/pages.tmpl @@ -1239,15 +1239,17 @@ nextsep(char *s, char **t) size_t r; if (gmtime_r(&rc->committer_time, &tm) == NULL || - strftime(datebuf, sizeof(datebuf), "%a %b %d %T %Y UTC", &tm) == 0) + asctime_r(&tm, datebuf) == NULL) return (-1); + + datebuf[strcspn(datebuf, "\n")] = '\0'; !} commit {{ rc->commit_id }} {{ "\n" }} from: {{ rc->author | unsafe }} {{ "\n" }} {{ if strcmp(rc->committer, rc->author) != 0 }} via: {{ rc->committer | unsafe }} {{ "\n" }} {{ end }} -date: {{ datebuf }} {{ "\n" }} +date: {{ datebuf }} {{ " UTC" }} {{ "\n" }} {{ "\n" }} {{ rc->commit_msg | unsafe }} {{ "\n" }} {! commit - 30935818050c098031758840ceaeb046cd533cf0 blob - f5b69323f573e23a2952fd042973bf8a9af06502 file + regress/gotwebd/test_gotwebd.sh --- regress/gotwebd/test_gotwebd.sh +++ regress/gotwebd/test_gotwebd.sh @@ -147,7 +147,7 @@ test_gotwebd_action_patch() BLOB_DELTA=$(get_blob_id $repo gamma delta) \ COMMITTER="Flan Hacker" \ COMMITTER_EMAIL="flan_hacker@openbsd.org" \ - COMMIT_DATE=$(date -u -r $author_time +"%a %b %d %X %Y") \ + COMMIT_DATE=$(date -u -r $author_time +"%a %b %e %X %Y") \ interpolate ${GOTWEBD_TEST_DATA_DIR}/action_patch.html \ > $testroot/content.expected -- Mark Jamsek <https://bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
gotwebd: replace strftime(3) with asctime_r(3)