* src/timefns.c (Ftime_equal_p): nil compares unequal to non-nil.
@defun time-equal-p t1 t2
This returns @code{t} if the two time values @var{t1} and @var{t2} are
-equal.
+equal. The result is @code{nil} if either argument is a NaN.
+For the purpose of comparison, a @code{nil} argument represents the
+current time with infinite resolution, so this function returns
+@code{nil} if one argument is @code{nil} and the other is not, and
+callers can therefore use @code{nil} to represent an unknown time
+value that does not equal any timestamp.
@end defun
@defun time-subtract t1 t2
See `format-time-string' for the various forms of a time value. */)
(Lisp_Object a, Lisp_Object b)
{
- return time_cmp (a, b) == 0 ? Qt : Qnil;
+ /* A nil arg compares unequal to a non-nil arg. This also saves the
+ expense of current_timespec if either arg is nil. */
+ return NILP (a) == NILP (b) && time_cmp (a, b) == 0 ? Qt : Qnil;
}
\f