Re: Date parsing
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jun 21, 2008, 22:37 UTC
- Message-ID
- <alpine.LFD.1.10.0806211530560.2926@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LFD.1.10.0806211507370.2926@woody.linux-foundation.org>
On Sat, 21 Jun 2008, Linus Torvalds wrote:
> > Remember: the git date handling was _not_ meant to be a generic date > library. It is very much meant to be a *git* date library.
Btw, I'm not proud of that. The whole of "date.c" was a huge hack to overcome the fact that
- standard library date parsing is pure and utter shit, even for standard date formats.
- Never mind the standard date formats, very few seem to do the relative dateslike "10 days ago".
- So I couldn't find anybody elses code to "borrow" that did a reasonable job and handled the nice relative dates too.
The GNU "date" command has pretty good support for doing things like "5 minutes ago", but I think I tried to look at the code, and quicky decided that it was not an option (when I say "I think I tried", I have to admit that I don't have strong memories from it, but I suspect it was all so utterly horrid that I repressed the episode).
I don't mind using other peoples code (the whole xdiff library and the SHA1 stuff was certainly all from outside), but it needs to be in a format that doesn't cause projectile vomiting.
If somebody has a good date parser, I think we could drop the git-specific one in an instant.
Or if somebody wants to just improve on it... Hint, hint.
Linus