Skip to content

Commit

Permalink
gitweb: Unify the way long timestamp is displayed
Browse files Browse the repository at this point in the history
format_timestamp_html loses its "-localtime => 1" option, and now
always print the local time (in author/comitter/tagger local
timezone), with "atnight" warning if needed.

This means that both 'summary' and 'log' views now display localtime.
In the case of 'log' view this can be thought as an improvement, as
now one can easily see which commits in a series are made "atnight"
and should be examined closer.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed May 24, 2011
1 parent 256b7b4 commit ce71b07
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3939,11 +3939,9 @@ sub git_print_section {
}

sub format_timestamp_html {
my ($date, %opts) = @_;
my $date = shift;
my $strtime = $date->{'rfc2822'};

return $strtime unless $opts{'-localtime'};

my $localtime_format = '(%02d:%02d %s)';
if ($date->{'hour_local'} < 6) {
$localtime_format = '(<span class="atnight">%02d:%02d</span> %s)';
Expand All @@ -3965,7 +3963,7 @@ sub git_print_authorship {
my %ad = parse_date($co->{'author_epoch'}, $co->{'author_tz'});
print "<$tag class=\"author_date\">" .
format_search_author($author, "author", esc_html($author)) .
" [".format_timestamp_html(\%ad, %opts)."]".
" [".format_timestamp_html(\%ad)."]".
git_get_avatar($co->{'author_email'}, -pad_before => 1) .
"</$tag>\n";
}
Expand All @@ -3992,7 +3990,7 @@ sub git_print_authorship_rows {
"</td></tr>\n" .
"<tr>" .
"<td></td><td>" .
format_timestamp_html(\%wd, -localtime=>1) .
format_timestamp_html(\%wd) .
"</td>" .
"</tr>\n";
}
Expand Down

0 comments on commit ce71b07

Please sign in to comment.