Re: [PATCH 1/2] gitweb: rename parse_date() to format_date()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 19, 2011, 18:00 UTC
- Message-ID
- <7vwrjvq9bg.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <ab54ba2199cc7487e383a31e3aa65885@localhost>
Kevin Cernekee <cernekee@gmail.com> writes:
Show 16 quoted lines
> One might reasonably expect a function named parse_date() to be used
> for something along these lines:
>
> $unix_time_t = parse_date("2011-03-19");
>
> But instead, gitweb's parse_date works more like:
>
> &parse_date(1300505805) = {
> 'hour' => 3,
> 'minute' => 36,
> ...
> 'rfc2822' => 'Sat, 19 Mar 2011 03:36:45 +0000',
> ...
> }
>
> Rename the function to improve clarity. No change to functionality.Except for a small detail that the function also takes the "-0800" timezone string, I think this is a good change.
The word "parse" makes the readers expect that its input is something "format" would have produced for use by others (often humans, but there are functions that parse xml ;-).