]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Add local time and timezone to git_print_authorship
authorJakub Narebski <redacted>
Mon, 28 Aug 2006 21:17:31 +0000 (23:17 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:10 +0000 (00:07 -0400)
Add local time (hours and minutes) and local timezone to the output of
git_print_authorship command, used by git_commitdiff.  The code was
taken from git_commit subroutine.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 09942030e1d5b12737d636e3f35007d5cbb52438b61b40f1fb1ae46241257da6..2701317afbed067c82cc1237046d6dfe429da68b51b420fc94d3f3fdde15e9be 100755 (executable)
@@ -1358,10 +1358,18 @@ sub git_print_header_div {
 sub git_print_authorship {
        my $co = shift;
 
 sub git_print_authorship {
        my $co = shift;
 
-       my %ad = parse_date($co->{'author_epoch'});
+       my %ad = parse_date($co->{'author_epoch'}, $co->{'author_tz'});
        print "<div class=\"author_date\">" .
              esc_html($co->{'author_name'}) .
        print "<div class=\"author_date\">" .
              esc_html($co->{'author_name'}) .
-             " [$ad{'rfc2822'}]</div>\n";
+             " [$ad{'rfc2822'}";
+       if ($ad{'hour_local'} < 6) {
+               printf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
+                      $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
+       } else {
+               printf(" (%02d:%02d %s)",
+                      $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
+       }
+       print "]</div>\n";
 }
 
 sub git_print_page_path {
 }
 
 sub git_print_page_path {
This page took 0.262066 seconds and 4 git commands to generate.