git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 6/7] gitweb: add a get function to compliment print_local_time

From
John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Date
Jan 13, 2010, 09:34 UTC
Message-ID
<1263375282-15508-7-git-send-email-warthog9@eaglescrag.net>
In-Reply-To
<1263375282-15508-6-git-send-email-warthog9@eaglescrag.net>
This adds a get function for print_local_time so that the basic
function can be used outside of their straight printing operation.
---
 gitweb/gitweb.perl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3b6bc06..3010fe3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3548,14 +3548,21 @@ sub git_print_header_div {
 }
 
 sub print_local_time {
+	print {$output_handler} get_local_time(@_);
+}
+
+sub get_local_time {
+	my $localtime = "";
 	my %date = @_;
 	if ($date{'hour_local'} < 6) {
-		printf({$output_handler} " (<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({$output_handler} " (%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.5.2
Previous: John 'Warthog9' HawleyNext: John 'Warthog9' Hawley
Message 7 of 11 in “Gitweb caching v4”
  1. 0/7 Gitweb caching v4John 'Warthog9' Hawley, Jan 13, 2010
  2. 1/7 gitweb: Load checkingJohn 'Warthog9' Hawley, Jan 13, 2010
  3. 2/7 gitweb: Add option to force version matchJohn 'Warthog9' Hawley, Jan 13, 2010
  4. 3/7 gitweb: Makefile improvementsJohn 'Warthog9' Hawley, Jan 13, 2010
  5. 4/7 gitweb: Optionally add "git" links in project list pageJohn 'Warthog9' Hawley, Jan 13, 2010
  6. 5/7 gitweb: Convert output to using indirect file handleJohn 'Warthog9' Hawley, Jan 13, 2010
  7. 6/7 gitweb: add a get function to compliment print_local_timeJohn 'Warthog9' Hawley, Jan 13, 2010
  8. 7/7 gitweb: File based caching layer (from git.kernel.org)John 'Warthog9' Hawley, Jan 13, 2010
  9. Junio C HamanoJan 14, 2010
  10. J.H.Jan 14, 2010
  11. Junio C HamanoJan 14, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.