Enhance threading support

There were situations in the fake_time() function where return was
invoked while the lock was still held.  Use an internal function to
ensure this doesn't happen.  Alternatively, if the extra function
call is deemed too expensive, we could use goto...
Handle pthread_cond_timedwait() in faketime

Some implementations of pthread_cond_timedwait() invoke the clock_gettime()
system call directly to obtain time, so they don't know about our fake time.
This is how glibc is usually compiled for example.  Provide an alternate
version of pthread_cond_timedwait() that modifies the timeout value to
respect the fake time.