What constant represents “never” for an NSTimeInterval?

守給你的承諾、 提交于 2019-12-13 02:26:30

问题


NSTimeInterval is a double, thus it cannot take a nil, and 0 represents something that should happen immediately. Is there a constant that means "never"... or an astronomically huge value, or should I use -1?


回答1:


As suggested by s.bandara, use a very large number to treat a time interval as "infinite" or "never".

DBL_MAX is the largest value a double can hold. This macro is declared in float.h:

#define DBL_MAX (9.999999999999999e999)


来源:https://stackoverflow.com/questions/28200472/what-constant-represents-never-for-an-nstimeinterval

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!