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

[RFC/PATCH 08/11] gitweb: Unify the way long timestamp is displayed

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 9, 2011, 22:49 UTC
Message-ID
<1302389366-21515-9-git-send-email-jnareb@gmail.com>
In-Reply-To
<1302389366-21515-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>
---
Not really necessary, though dropping it from series would probably
require resolving trivial spurious textual conflicts.

It is marked as an RFC because I am not quite satisfied with the way 'log' view looks like after this change, though OTOH this change is an improvement for 'log' view...

 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 9 of 19 in “gitweb: Change timezone”
  1. 00/11 gitweb: Change timezoneJakub Narebski, Apr 9, 2011
  2. 01/11 gitweb: Split JavaScript for maintability, combining on buildJakub Narebski, Apr 9, 2011
  3. 02/11 gitweb.js: Update and improve comments in JavaScript filesJakub Narebski, Apr 9, 2011
  4. 03/11 gitweb.js: Provide default values for padding in padLeftStr and padLeftJakub Narebski, Apr 9, 2011
  5. 04/11 gitweb.js: Extract and improve datetime handlingJakub Narebski, Apr 9, 2011
  6. 05/11 gitweb.js: Introduce gitweb/static/js/lib/cookies.jsJakub Narebski, Apr 9, 2011
  7. 06/11 gitweb.js: Provide getElementsByClassName method (if it not exists)Jakub Narebski, Apr 9, 2011
  8. 07/11 gitweb: Refactor generating of long dates into format_timestamp_htmlJakub Narebski, Apr 9, 2011
  9. 08/11 gitweb: Unify the way long timestamp is displayedJakub Narebski, Apr 9, 2011
  10. 09/11 gitweb: JavaScript ability to adjust time based on timezoneJakub Narebski, Apr 9, 2011
  11. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 9, 2011
  12. Jakub NarebskiApr 10, 2011
  13. Jakub NarebskiApr 10, 2011
  14. Jakub NarebskiApr 10, 2011
  15. 11/11 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 9, 2011
  16. Kevin CernekeeApr 12, 2011
  17. Jakub NarebskiApr 12, 2011
  18. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 12, 2011
  19. 11/11 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 12, 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.