Fix compilation on osx sierra (10.12)
OSX Sierra (which came out last week) broke compilation in two ways:
- It added a getentropy() function, but only if you include sys/random.h (which nobody else seems to require).
- It added clock_gettime(), but uses a wider type for tv_nsec than tv_usec (why? Where does apple run that provides an "int" that holds up to 1e6, but where you need a "long" to hold 1e9??).
- It added clock_gettime(), but didn't add pthread_condattr_setclock() (whereas everybody else supports neither or both).
My branch osx_sierra_028
fixes both. I'm going to merge it to master as low-risk so I can keep doing development, and ask for review on getting it into 028.