Skip to content

Commit

Permalink
gitweb: add a "string" variant of print_local_time
Browse files Browse the repository at this point in the history
Add a function (named format_local_time) that returns the string that
print_local_time would print.

Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
John 'Warthog9' Hawley authored and Junio C Hamano committed Jan 30, 2010
1 parent 24d4afc commit 0cf207f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3509,14 +3509,21 @@ sub git_print_header_div {
}

sub print_local_time {
print format_local_time(@_);
}

sub format_local_time {
my $localtime = '';
my %date = @_;
if ($date{'hour_local'} < 6) {
printf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
$localtime .= sprintf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
$date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'});
} else {
printf(" (%02d:%02d %s)",
$localtime .= sprintf(" (%02d:%02d %s)",
$date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'});
}

return $localtime;
}

# Outputs the author name and date in long form
Expand Down

0 comments on commit 0cf207f

Please sign in to comment.