Ct_clock ct_install_clock( Ct_clock clock_function );
If you pass a NULL parameter, ct_install_clock() installs the default timer function, which is based on the standard clock() function.
A Ct_clock is typedefed in ct.h as a pointer to a function that accepts no parameters and returns a Ct_time by value. The return value should represent the current system time.
A Ct_time is declared in ct.h as the following structure:
typedef struct /* For timers */
{
unsigned long tick; /* ticks */
unsigned long era; /* cycles of ULONG_MAX + 1 ticks */
} Ct_time;
The tick member represents the smallest interval of time recognized
by the timer. It may represent seconds, hundredths of a second, or
whatever unit of time is appropriate for the application.
The era member is used for overflow. Increment the era member whenever you increment the tick member past LONG_MAX as defined in limits.h. By this means you can use a Ct_time to represent extremely long intervals. If your application will never run long enough for overflow to be an issue, your timer function can ignore the era member.
The ct_install_clock function is available only if you compile Cheap Threads with the CT_TIMEOUT macro defined.