pl_thread: use gettimeofday() for back-compat
Some older platforms (particularly macOS) do not support clock_gettime(). Fortunately, this is identical to gettimeofday in the case of CLOCK_REALTIME.
These systems also do not have pthread_condattr_setclock, so we can re-use this check.
Also add proper error handling to this function.