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

Re: [PATCH 2/2] gitweb: introduce localtime feature

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 17, 2011, 11:01 UTC
Message-ID
<m3d3lq57vw.fsf@localhost.localdomain>
In-Reply-To
<e272fa98ecab9d30edb4457e2e215688@localhost>
Kevin Cernekee <cernekee@gmail.com> writes:
> With this feature enabled, all timestamps are shown in the machine's
> local timezone instead of GMT.

This does not describe why would one want such way of displaying timestamps, and which views would be affected.

BTW. should it be timezone of web server (machine where gitweb is
run), or local time of author / committer / tagger as described in the
timezone part of git timestamp?
 
Show 19 quoted lines
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
>  gitweb/gitweb.perl |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 3b6a90d..d171ad5 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -504,6 +504,12 @@ our %feature = (
>  		'sub' => sub { feature_bool('remote_heads', @_) },
>  		'override' => 0,
>  		'default' => [0]},
> +
> +	# Use localtime rather than GMT for all timestamps.  Disabled
> +	# by default.  Project specific override is not supported.
> +	'localtime' => {
> +		'override' => 0,
> +		'default' => [0]},

Why project specific override is not supported? I think it might make sense to enable this feature on project-by-project basis; some projects might be dispersed geographically, some might not.

It is not as if this feature affect only non-project views, or doesn't make sense on less that site-wide basis, like other nonoverridable features.

Show 13 quoted lines
>  );
>  
>  sub gitweb_get_feature {
> @@ -2927,6 +2933,12 @@ sub parse_date {
>  	$date{'iso-tz'} = sprintf("%04d-%02d-%02d %02d:%02d:%02d %s",
>  	                          1900+$year, $mon+1, $mday,
>  	                          $hour, $min, $sec, $tz);
> +
> +	if (gitweb_check_feature('localtime')) {
> +		$date{'rfc2822'}   = sprintf "%s, %d %s %4d %02d:%02d:%02d $tz",
> +				     $days[$wday], $mday, $months[$mon],
> +				     1900+$year, $hour ,$min, $sec;
> +	}

Is it still an RFC 2822 conformant date? If it is not, then above change is invalid, and we have to implement this feature in different way.

Show 9 quoted lines
>  	return %date;
>  }
>  
> @@ -3989,7 +4001,7 @@ sub git_print_authorship_rows {
>  		      "</td></tr>\n" .
>  		      "<tr>" .
>  		      "<td></td><td> $wd{'rfc2822'}";
> -		print_local_time(%wd);
> +		print_local_time(%wd) if !gitweb_check_feature('localtime');

Hmmm... I wonder if it wouldn't be better to print both times (perhaps reversed) in this case...

Show 6 quoted lines
>  		print "</td>" .
>  		      "</tr>\n";
>  	}
> -- 
> 1.7.4.1
> 
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Kevin CernekeeNext: Junio C Hamano
Message 3 of 10 in “gitweb: fix #patchNN anchors when path_info is enabled”
  1. 1/2 gitweb: fix #patchNN anchors when path_info is enabledKevin Cernekee, Mar 16, 2011
  2. 2/2 gitweb: introduce localtime featureKevin Cernekee, Mar 16, 2011
  3. Jakub NarebskiMar 17, 2011
  4. Junio C HamanoMar 17, 2011
  5. Kevin CernekeeMar 17, 2011
  6. Jakub NarebskiMar 17, 2011
  7. Jakub NarebskiMar 17, 2011
  8. Junio C HamanoMar 17, 2011
  9. Jakub NarebskiMar 17, 2011
  10. Junio C HamanoMar 17, 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.