Re: [PATCH] Round-down years in "years+months" relative date view
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- Aug 28, 2009, 18:49 UTC
- Message-ID
- <81b0412b0908281149i2182f95ob51fee82e29e8fdf@mail.gmail.com>
- In-Reply-To
- <81b0412b0908281142v7e1b73ddvb727abe915dace86@mail.gmail.com>
On Fri, Aug 28, 2009 at 20:42, Alex Riesen<raa.lkml@gmail.com> wrote:
Show 6 quoted lines
> On Fri, Aug 28, 2009 at 20:39, Jeff King<peff@peff.net> wrote: >> On Fri, Aug 28, 2009 at 08:27:06PM +0200, Alex Riesen wrote: >> >>> > Thanks, that is a much better solution. And I don't know offhand of any >>> > portability problems in overriding the library at link time. >>>
Hm, how about supplying show_date and approxidate with current time? Like this:
/* exported */ const char *show_date_rel(unsigned long time, int tz, struct timeval *now) { ... the DATE_RELATIVE path of show_date }
const char *show_date(unsigned long time, int tz, enum date_mode mode)
{
struct timeval now;
if (mode == DATE_RELATIVE) {
gettimeofday(&now, NULL);
return show_date_rel(time, tz, &now);
}
... other paths of old show_date
}Still affects the performance, but much less, and no side effects. And you can test show_date_rel path in test-date.c