commit e385fc421f331989f2e6518465e5ead42e5a0618 from: Stefan Sperling date: Mon Aug 30 15:48:05 2021 UTC use gmtime_r(3) instead of localtime_r(3) to display time in UTC as intended Problem noticed by naddy due to failing regress tests at midnight, and then analyzed with additional help from millert. ok naddy commit - 92952c0ecd960182cd5822e21126351bff23ad61 commit + e385fc421f331989f2e6518465e5ead42e5a0618 blob - f48598b57aa7474d4174c928c96d948834824f21 blob + b008eec8b509913ce8be844f671bf5e5290d0296 --- got/got.c +++ got/got.c @@ -4659,8 +4659,8 @@ blame_cb(void *arg, int nlines, int lineno, struct got } committer_time = got_object_commit_get_committer_time(commit); - if (localtime_r(&committer_time, &tm) == NULL) - return got_error_from_errno("localtime_r"); + if (gmtime_r(&committer_time, &tm) == NULL) + return got_error_from_errno("gmtime_r"); if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G-%m-%d", &tm) == 0) { err = got_error(GOT_ERR_NO_SPACE); @@ -8414,8 +8414,8 @@ get_commit_brief_str(char **brief_str, struct got_comm char *logmsg0 = NULL, *logmsg, *newline; committer_time = got_object_commit_get_committer_time(commit); - if (localtime_r(&committer_time, &tm) == NULL) - return got_error_from_errno("localtime_r"); + if (gmtime_r(&committer_time, &tm) == NULL) + return got_error_from_errno("gmtime_r"); if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d", &tm) == 0) return got_error(GOT_ERR_NO_SPACE); blob - 7d851f4f247951408191157cdfd7b2a4a3eb97e0 blob + 360a75d7bbb481e8975ca6e111ac718511e742a3 --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -3909,8 +3909,8 @@ gw_blame_cb(void *arg, int nlines, int lineno, struct } committer_time = got_object_commit_get_committer_time(commit); - if (localtime_r(&committer_time, &tm) == NULL) - return got_error_from_errno("localtime_r"); + if (gmtime_r(&committer_time, &tm) == NULL) + return got_error_from_errno("gmtime_r"); if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G-%m-%d", &tm) == 0) { err = got_error(GOT_ERR_NO_SPACE); blob - c175ea3c10692ebe9286741d643cd9b65fb4140c blob + fc51be808de240c6c11edb65c15e8270ca3fffe3 --- tog/tog.c +++ tog/tog.c @@ -1340,8 +1340,8 @@ draw_commit(struct tog_view *view, struct got_commit_o struct tog_color *tc; committer_time = got_object_commit_get_committer_time(commit); - if (localtime_r(&committer_time, &tm) == NULL) - return got_error_from_errno("localtime_r"); + if (gmtime_r(&committer_time, &tm) == NULL) + return got_error_from_errno("gmtime_r"); if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d ", &tm) == 0) return got_error(GOT_ERR_NO_SPACE);