When you have a tea time, why shouldn't Git have it too? Learn about it.

Being a curious kitten, I planned to compile git with crazy options on my Mac OS as it's based on a linux core and I really wanted to try out the all great make function. I went through the C language code, which is what git is written in and then stumbled across a lot of modules.

I was looking at the Date module and one particular line of code interested me a lot:

static const struct special {  
    const char *name;
    void (*fn)(struct tm *, struct tm *, int *);
} special[] = {
    { "yesterday", date_yesterday },
    { "noon", date_noon },
    { "midnight", date_midnight },
    { "tea", date_tea },
    { "PM", date_pm },
    { "AM", date_am },
    { "never", date_never },
    { "now", date_now },
    { NULL }
};

And in another set of lines, I saw this:

static void date_tea(struct tm *tm, int *num)  
{
    date_time(tm, 17);
}

So what's happening here is, the date_tea is a custom object, a.k.a. structure in git's code, which sets the time to 17 hours, which is 5 pm precisely. This could have been an Easter Egg and that's what it was here.

According to a commit titled Teach "approxidate" about weekday syntax by Linus Torvalds, I feel that it was suggested initially as a joke, but actually implemented to demonstrate the ability for users to include their own custom time / date periods, the answerer says:

On Fri, 18 Nov 2005, David Roundy wrote:  
>
> Don't forget "high noon"!  (and perhaps "tea time"?)  :)

Done.

    [torvalds@g5 git]$ ./test-date "now" "midnight" "high noon" "tea-time"
    now -> bad -> Wed Dec 31 16:00:00 1969
    now -> Fri Nov 18 08:50:54 2005

    midnight -> bad -> Wed Dec 31 16:00:00 1969
    midnight -> Fri Nov 18 00:00:00 2005

    high noon -> bad -> Wed Dec 31 16:00:00 1969
    high noon -> Thu Nov 17 12:00:00 2005

    tea-time -> bad -> Wed Dec 31 16:00:00 1969
    tea-time -> Thu Nov 17 17:00:00 2005

Thanks for pointing out tea-time.

This is also written to easily extended to allow people to add their own  
important dates like Christmas and their own birthdays.

Signed-off-by: Linus Torvalds <[email protected]>  
Signed-off-by: Junio C Hamano <[email protected]>  

To get this right, one user pointed out:

You can have custom features if you modify the source and recompile it.

I planned to work on this project and miserably failed. Another peer commented this way:

Which is even funnier, because the one time I tried to create a small addition to git, it wouldn't even compile right after a clone ¯_(ツ)_/¯

And it's really true. Especially, when projects like git or say, Windows 95 (I do have a source code through my MVP Award), or Dangerous Dave Game, it just doesn't work to recompile the project. There could be hundreds of reasons why, as in the environment and the machine, even sometimes the hardware is also to be blamed.

That's what another user says:

Build systems are fun like that, either get used to it or solve the issue and contribute to the free open source project.

And there lies the problem with Free and Open Source Software. Just wanted to share my findings on this. I would be happy to update the contents of this post when more information is found on what happened in their discussion.



comments powered by Disqus