diff options
author | John 'Warthog9' Hawley <warthog9@kernel.org> | 2010-01-30 23:30:42 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-30 15:53:54 -0800 |
commit | 0cf207f7a621d2f15bc3a5ec0fa6a7c8f3333386 (patch) | |
tree | 5db169242c9fb74f57aad49828009205da65e2eb | |
parent | 24d4afcdc79cb250131841040b803401d261a473 (diff) | |
download | git-0cf207f7a621d2f15bc3a5ec0fa6a7c8f3333386.tar.gz git-0cf207f7a621d2f15bc3a5ec0fa6a7c8f3333386.tar.xz |
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>
-rwxr-xr-x | gitweb/gitweb.perl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a4148d36a..debaf55e8 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -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 |