Avian’s Blog

Electronics and Free Software

Why I like free software

13.03.2006 10:15

I really like the way art.gnome.org displays dates. Instead of giving you a boring "Mon Mar 11 02:25:47", that leaves you wondering what the current date and time is, it will for example simply say "Two days ago".

I would like to display document modification dates in this same way in the next version of my Nanobeagle search engine. Of course, I could write a function that gives a date in this form myself. It would probably be just a matter of some simple arithmetic and comparisons, but why should I reinvent the wheel?

So I set out to find the original function behind this date display. A quick search through the FAQ and Forums on the site revealed no information on what software art.gnome.org is running. When searching for "art.gnome.org software" on Google all hits were about the graphical front-end software "Gnome Art" not the CGI scripts that are running the site itself.

Ok, perhaps GNOME people store their web scripts in their CVS repository. My first guesses were "web" and "web-devel-1" projects, but they seem to only contain static pages. Finally it turned out that "art-web" was the right choice. A quick cvs checkout and grep for the word "yesterday" later, I found the FormatRelativeDate() function I was looking for.

Posted by Tomaž | Categories: Code
Comments
Add a new comment

Your name

Your email (optional, will be shown publicly)

Your web site (optional)


(No HTML tags allowed. Separate paragraphs with a blank line.)