Re: [PATCH 3/3 (alternate)] gitweb: Mark "atnight" author/committer times also for 'localtime'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski <jnareb@xxxxxxxxx> writes:

> Junio C Hamano wrote:
> ...
>> and format_timestamp would be like
>> 
>> 	sub format_timestamp {
>> 		my %date = %$_[0];
>>       	my $use_localtime = $_[1];
>> 		my $localtime, $ret, $nite;
>> 
>> 		$nite = ($date{'hour_local'} < 6);
>> 
>> 		if ($use_localtime) {
>> 			$ret = $date{'rfc2822_local'};
>>       		if ($nite) {
>>                         	$ret = sprintf("<span class='atnight'>%s</span>", $ret);
>> 			}
>> 		} else {
>> 			... what the current format_local_time does to set
>> 	        	... including the spanning part
>>               	$ret = "$date{'rfc2822'} ($localtime)";
>> 		}
>> 		return $ret;
>> 	}
>
> Well, if we go this route, and assuming that parse_date does only parsing
> and we use separate subroutine for generating date in an rfc2822 format,
> then we could mark only time with "atnight" also when 'localtime' feature
> is enabled.
>  
>> Wouldn't it be much cleaner?  You can then clean up the other call site of
>> print_local_time in git_print_authorship using the same helper function
>> (presumably you would always pass 0 to $use_localtime there), no?
>
> Right.  Well, I'd have to think a bit about API for format_timestamp,
> but it looks like good direction.

I don't think there is much to think about for format_timestamp, as I was
suggesting to keep what comes in %date more or less the same as what the
current parse_date() generates.  I was only hinting that parse_date() is
misnamed.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]