Code

gitweb: Add local time and timezone to git_print_authorship
authorJakub Narebski <jnareb@gmail.com>
Mon, 28 Aug 2006 21:17:31 +0000 (23:17 +0200)
committerJunio C Hamano <junkio@cox.net>
Mon, 28 Aug 2006 23:44:14 +0000 (16:44 -0700)
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 <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl

index 1b352cbb25c525159d06a3c1c2e67f7524a02ff3..9324d71ebe4e01a8f9985a32990acc94636008f9 100755 (executable)
@@ -1358,10 +1358,18 @@ sub git_print_header_div {
 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'}) .
-             " [$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 {