ct_timecmp

The ct_timecmp function compares two times as represented by the Ct_time structure.

Prototype:

int ct_timecmp( const Ct_time * t1, const Ct_time * t2 );

Parameters:

t1
A pointer to a Ct_time representing the first time.

t2
A pointer to a Ct_time representing the second time.

Return Value:

A Ct_handle referring to the current thread.

Discussion:

The ct_timecmp function is similar to the standard strcmp function, except that it compares times (as represented by Ct_times) instead of character strings.

If the first time is greater than the second time, ct_timecmp() returns a positive number. If it is less than the the second time, it returns a negative number. If the two times are equal, ct_timecmp returns zero.

This fairly trivial comparison was needed to implement the timeout mechanism. However, unlike other code related to timeouts, the ct_timecmp function is available as a convenience even if the library is compiled with timeouts disabled. That way you can use it in other kinds of timing logic unrelated to timeouts.

Restrictions:

You can call ct_timecmp() at any time.
Home