4

对于家庭作业,我正在编写一个处理大量time_t对象的程序。我考虑过检查它们是否溢出,但后来我想到如果它们溢出,我们都会遇到一些麻烦。

有这方面的计划吗?当自纪元以来的时间超过存储时会发生什么?

4

1 回答 1

10

LONG_MAX on a 64-bit machine is 2^63 - 1. Try this: go to http://google.com and enter 2^63 seconds in years. Look at the answer and decide whether you really need to worry about it.

于 2012-01-31T05:26:40.333 回答