我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