问题
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