From: Jakub Narebski Date: Sat, 30 Jan 2010 22:30:42 GMT Subject: [PATCH 5/8 v6] gitweb: add a get function to compliment print_local_time Message-ID: <1264890645-28310-6-git-send-email-jnareb@gmail.com> In-Reply-To: <1264890645-28310-1-git-send-email-jnareb@gmail.com> From: John 'Warthog9' Hawley This adds a get function (named format_local_time) for print_local_time, so that the basic function can be used outside of their straight printing operation. Signed-off-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski --- Changes from version from 'Gitweb caching v5' and git://git.kernel.org/pub/scm/git/warthog9/gitweb.git gitweb-ml-v5 * Change function name from get_* to format_*, following gitweb subroutine naming convention. * Add final ';' gitweb/gitweb.perl | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a4148d3..debaf55 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(" (%02d:%02d %s)", + $localtime .= sprintf(" (%02d:%02d %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 -- 1.6.6.1