From: Jeff King <peff@peff.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: Improve on 'approxidate'
Date: Sun, 30 Aug 2009 18:35:58 -0400 [thread overview]
Message-ID: <20090830223558.GA29807@coredump.intra.peff.net> (raw)
In-Reply-To: <alpine.LFD.2.01.0908221438450.3158@localhost.localdomain>
On Sat, Aug 22, 2009 at 03:10:07PM -0700, Linus Torvalds wrote:
> unsigned long approxidate(const char *date)
> {
> int number = 0;
> @@ -881,21 +911,24 @@ unsigned long approxidate(const char *date)
> time_sec = tv.tv_sec;
> localtime_r(&time_sec, &tm);
> now = tm;
> +
> + tm.tm_year = -1;
> + tm.tm_mon = -1;
> + tm.tm_mday = -1;
This breaks relative dates like "3.months.ago", because
approxidate_alpha needs to see the "current" date in tm (and now it sees
-1, subtracts from it, and assumes we are just crossing a year boundary
because of the negative). 3.years.ago is also broken, but I don't think
3.days.ago is.
Probably we just need to pass "now" to approxidate_alpha, and it needs
to call update_tm under the case for "months" and "years" (and I haven't
quite figured out why those are not part of the "tl" list).
Unfortunately, I'm out of time to look at it more right now, but I'll
take a look tonight or tomorrow if you don't beat me to it.
-Peff
next prev parent reply other threads:[~2009-08-30 22:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-22 22:10 Improve on 'approxidate' Linus Torvalds
2009-08-23 1:11 ` Further 'approxidate' improvements Linus Torvalds
2009-08-23 2:08 ` Nicolas Pitre
2009-08-30 22:35 ` Jeff King [this message]
2009-08-31 1:58 ` Improve on 'approxidate' Jeff King
2009-09-01 3:27 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090830223558.GA29807@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).