为什么从0-60,而不是0-59在time.h中tm_sec范围是多少? [英] Why does tm_sec range from 0-60 instead of 0-59 in time.h?

查看:863
本文介绍了为什么从0-60,而不是0-59在time.h中tm_sec范围是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 time.h中有如下定义 TM

struct tm {
    int tm_sec;		/* seconds after the minute [0-60] */
    int tm_min;		/* minutes after the hour [0-59] */
    int tm_hour;	/* hours since midnight [0-23] */
    ...
}

我只注意到他们记录 tm_sec 为取值范围 0-60 的包容性。我一直以为它从0-59不等就像 tm_min 。我当然从来没有见过一个时钟读10:37:60 ...

I just noticed that they document tm_sec as ranging between 0-60 inclusive. I've always assumed it ranged from 0-59 just like tm_min. I've certainly never seen a clock read 10:37:60...

你认为这仅仅是从这个90年代的时代伯克利分校发起的文件遗留下来的文档错误?

Do you think this is just a documentation bug left over from this 90's era Berkley-originated file?

或者是有什么更微妙的事情,我是不知道的?

推荐答案

闰秒都是这样做的原因

一个闰秒是正负一秒调整,协调世界时(UTC)时间保持它接近的意思是太阳的时间尺度。

A leap second is a plus or minus one-second adjustment to the Coordinated Universal Time (UTC) time scale that keeps it close to mean solar time.

当一个正闰秒是在23:59:60 UTC补充说,这延缓了以下UTC一天的开始(00:00:00 UTC)一秒,有效地减缓了UTC时钟。

When a positive leap second is added at 23:59:60 UTC, it delays the start of the following UTC day (at 00:00:00 UTC) by one second, effectively slowing the UTC clock.

这篇关于为什么从0-60,而不是0-59在time.h中tm_sec范围是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆