git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Linus TorvaldsNext: Stephan Beyer
Message 10 of 11 in “Date parsing”
  1. Sverre RabbelierJun 10, 2008
  2. Johannes SixtJun 10, 2008
  3. Sverre RabbelierJun 10, 2008
  4. Brandon CaseyJun 10, 2008
  5. Sverre RabbelierJun 10, 2008
  6. Linus TorvaldsJun 10, 2008
  7. Sverre RabbelierJun 10, 2008
  8. Stephan BeyerJun 21, 2008
  9. Linus TorvaldsJun 21, 2008
  10. Linus TorvaldsJun 21, 2008
  11. Stephan BeyerJun 21, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.