Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Git有喝茶的时间?_Git - Fatal编程技术网

为什么Git有喝茶的时间?

为什么Git有喝茶的时间?,git,Git,在Git源代码中的文件中,我注意到特殊时间名称的以下结构: static const struct special { const char *name; void (*fn)(struct tm *, struct tm *, int *); } special[] = { { "yesterday", date_yesterday }, { "noon", date_noon }, { "midnight", date_midnight },

在Git源代码中的文件中,我注意到特殊时间名称的以下结构:

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 }
};

我了解其中大多数的效用(多少),但为什么要有“喝茶”时间(估计为17:00小时)?这只是一种分类吗?

此提交可能会为您提供一条线索,说明它为什么会被包括在内:

我认为它最初是作为一个笑话提出的,但实际上是为了证明用户能够包含自己的自定义时间/日期周期:

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 <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005年11月18日,星期五,戴维·鲁迪写道:
>别忘了“正午”!(也许还有“喝茶时间”?):)
完成。
[torvalds@g5git]$/测试日期“现在”“午夜”“正午”“茶点时间”
现在->坏->1969年12月31日星期三16:00:00
现在->2005年11月18日星期五08:50:54
午夜->糟糕->周三1969年12月31日16:00:00
午夜->2005年11月18日星期五00:00:00
正午->糟糕->周三1969年12月31日16:00:00
中午->2005年11月17日星期四12:00:00
茶点时间->糟糕->周三1969年12月31日16:00:00
茶点时间->2005年11月17日星期四17:00:00
谢谢你指出茶点时间。
这也是为了方便扩展而编写的,以允许人们添加自己的
重要的日子,如圣诞节和他们自己的生日。
签字人:Linus Torvalds
签字人:Junio C Hamano

那么,要添加一个新的自定义日期,是否需要用特定的更改重新编译Git?还是有一些编译后的步骤可以指定这些?我对approxidate及其工作原理不太熟悉,无法回答。从缺少相关文档来看,我可能会说是的——您需要重新编译git来支持它。@Jonahbshop,您不知道吗?如果您修改源代码并重新编译它,您可以拥有自定义功能…@jhpratt我认为这里没有问题。没有人承诺你添加的自定义设置会很容易使用。@jhpratt构建系统很有趣,要么习惯它,要么解决问题,为免费开源项目贡献力量。