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

[PATCH 10/13] gitweb: Unify the way long timestamp is displayed

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 28, 2011, 19:04 UTC
Message-ID
<1304017451-12283-11-git-send-email-jnareb@gmail.com>
In-Reply-To
<1304017451-12283-1-git-send-email-jnareb@gmail.com>

format_timestamp_html loses its "-localtime => 1" option, and now always print the local time (in author/comitter/tagger local timezone), with "atnight" warning if needed.

This means that both 'summary' and 'log' views now display localtime. In the case of 'log' view this can be thought as an improvement, as now one can easily see which commits in a series are made "atnight" and should be examined closer.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is unchanged from first version of this series.

It is not really necessary (at least not as part of this series), though dropping it from series would probably require resolving trivial spurious textual conflicts. On the other hand it is natural enhancement to previous patch, and could have been squashed with it, if I didn't want the previous patch to be pure refactoring, without changing gitweb output.

It was marked as an RFC in first version of this series, because I was not quite satisfied with the way 'log' view looks like after this change, but it grew up on me (well, I have a few doubts about new look of 'summary' page).

This patch has of course no equivalent in original J.H. patch.
 gitweb/gitweb.perl |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7329db2..67bcfe8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3939,11 +3939,9 @@ sub git_print_section {
 }
 
 sub format_timestamp_html {
-	my ($date, %opts) = @_;
+	my $date = shift;
 	my $strtime = $date->{'rfc2822'};
 
-	return $strtime unless $opts{'-localtime'};
-
 	my $localtime_format = '(%02d:%02d %s)';
 	if ($date->{'hour_local'} < 6) {
 		$localtime_format = '(<span class="atnight">%02d:%02d</span> %s)';
@@ -3965,7 +3963,7 @@ sub git_print_authorship {
 	my %ad = parse_date($co->{'author_epoch'}, $co->{'author_tz'});
 	print "<$tag class=\"author_date\">" .
 	      format_search_author($author, "author", esc_html($author)) .
-	      " [".format_timestamp_html(\%ad, %opts)."]".
+	      " [".format_timestamp_html(\%ad)."]".
 	      git_get_avatar($co->{'author_email'}, -pad_before => 1) .
 	      "</$tag>\n";
 }
@@ -3992,7 +3990,7 @@ sub git_print_authorship_rows {
 		      "</td></tr>\n" .
 		      "<tr>" .
 		      "<td></td><td>" .
-		      format_timestamp_html(\%wd, -localtime=>1) .
+		      format_timestamp_html(\%wd) .
 		      "</td>" .
 		      "</tr>\n";
 	}
-- 
1.7.3
Previous: Jakub NarebskiNext: Jakub Narebski
Message 11 of 14 in “[PATCHv3 00/13] gitweb: Change timezone in dates using JavaScript”
  1. Jakub NarebskiApr 28, 2011
  2. 01/13 git-instaweb: Simplify build dependency on gitwebJakub Narebski, Apr 28, 2011
  3. 02/13 Remove gitweb/gitweb.cgi and other legacy targets from main MakefileJakub Narebski, Apr 28, 2011
  4. 03/13 gitweb: Split JavaScript for maintability, combining on buildJakub Narebski, Apr 28, 2011
  5. 04/13 gitweb.js: Update and improve comments in JavaScript filesJakub Narebski, Apr 28, 2011
  6. 05/13 gitweb.js: Provide default values for padding in padLeftStr and padLeftJakub Narebski, Apr 28, 2011
  7. 06/13 gitweb.js: Extract and improve datetime handlingJakub Narebski, Apr 28, 2011
  8. 07/13 gitweb.js: Introduce code to handle cookies from JavaScriptJakub Narebski, Apr 28, 2011
  9. 08/13 gitweb.js: Provide getElementsByClassName method (if it not exists)Jakub Narebski, Apr 28, 2011
  10. 09/13 gitweb: Refactor generating of long dates into format_timestamp_htmlJakub Narebski, Apr 28, 2011
  11. 10/13 gitweb: Unify the way long timestamp is displayedJakub Narebski, Apr 28, 2011
  12. 11/13 gitweb: JavaScript ability to adjust time based on timezoneJakub Narebski, Apr 28, 2011
  13. 12/13 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 28, 2011
  14. 13/13 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 28, 2011

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.