我time.h
有tm
定义如下:为什么tm_sec在time.h中的范围是0-60而不是0-59?
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 ...
您是否认为这只是从90年代Berkley发起的文件遗留下来的文档错误?
还是有什么更微妙的事情发生,我不知道?
+1:打我23秒。你的猜测是正确的。 – dwc 2009-04-19 17:44:13