From: Junio C Hamano Date: Sat, 19 Mar 2011 01:25:39 GMT Subject: Re: [PATCH 3/3 (alternate)] gitweb: Mark "atnight" author/committer times also for 'localtime' Message-ID: <7vaagrsxyk.fsf@alter.siamese.dyndns.org> In-Reply-To: <201103182328.19141.jnareb@gmail.com> Jakub Narebski 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("%s", $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.