<>你不能这样做。 时间――t isn t 甚至必然是整体类型。 这可能是一种障碍或实际上的任何东西。
既然你想重新确定谁是谁是谁是谁,那么你为什么不在那里使用正确的类型? 这被定义为长期,因此,你应当:
tv.tv_sec = std::numeric_limits<long int>::max();
Although, I notice now that POSIX says tv_sec is a time_t even though MSDN and the GNU libc use long int. These old time APIs that can t even distinguish between durations and time points are definitely due for replacement. If you can use C++11 check out std::chrono.
任何途径,std: 识数_limits<std:time_t>:max(
事实上,甚至视窗都给予最大时间——t值。 问题只是“温得”的定义: tv_sec isn t time_t as POSIX mandate, and so the put to long int have the anti number.
However this can be fixed on Windows by defining _USE_32BIT_TIME_T. This will cause the definition for time_t to match the type used in timeval for tv_sec, and then your std::numeric_limits<time_t>::max()
will work.