Re: [PATCH 1/2] Add date formatting and parsing functions relative to a given time
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- Aug 30, 2009, 07:51 UTC
- Message-ID
- <81b0412b0908300051g19bc2c5buecf5d925bd0d40b6@mail.gmail.com>
- In-Reply-To
- <20090830073619.GA14217@coredump.intra.peff.net>
On Sun, Aug 30, 2009 at 09:36, Jeff King<peff@peff.net> wrote:
Show 9 quoted lines
> On Fri, Aug 28, 2009 at 11:04:04PM +0200, Alex Riesen wrote:
>
>> +const char *show_date_relative(unsigned long time, int tz, const struct timeval *now)
>> +{
>> + static char timebuf[100 /* TODO: can be optimized */];
>
> This was 200 in the original version. I doubt that it makes a
> difference, but I think in a refactoring patch I think it is best to
> simply reorganize and make no other changes.Yes, I just noticed that 200 was much too much, made the note to fix it sometime and forgot the note in the final submission.
Show 5 quoted lines
>> +static unsigned long approximation(const char *date, const struct timeval *tv) > > I know it's static, but this is a terribly undescriptive function name. > Approximation of what? Can we call it approxidate_internal or > something?
Been there, tried that. Didn't like it, because it didn't feel enough approxidate (the original) anymore. Not even internally, because of missing parse_date. My other attempts were guessdate and approxidate_bottom_half (but only very shortly).
The "approximation", if you consider the functions arguments, seems to me the closest to what the function _is_. OTOH, maybe I should have used a verb...