@matheusbsbs / matheus-bagliano / commits / 0cf207f7a6
Fork 0

gitweb: add a "string" variant of print_local_time

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>

John 'Warthog9' Hawley committed Jan 30, 2010 at 23:30 UTC 0cf207f7a621d2f15bc3a5ec0fa6a7c8f3333386
1 file changed +9 -2
gitweb/gitweb.perl
+9 -2
@@ -3509,14 +3509,21 @@ sub git_print_header_div {
3509 }
3510
3511 sub print_local_time {
3512 + print format_local_time(@_);
3513 +}
3514 +
3515 +sub format_local_time {
3516 + my $localtime = '';
3517 my %date = @_;
3518 if ($date{'hour_local'} < 6) {
3514 - printf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
3519 + $localtime .= sprintf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
3520 $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'});
3521 } else {
3517 - printf(" (%02d:%02d %s)",
3522 + $localtime .= sprintf(" (%02d:%02d %s)",
3523 $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'});
3524 }
3525 +
3526 + return $localtime;
3527 }
3528
3529 # Outputs the author name and date in long form