Add missing #ifdefs where necessary.

Although your branches are supposed to be used on the Raspberry Pi, I found a few commits useful on other platforms too, in my case I'm applying newclock4 on OS X.

This just adds a couple missing `#ifdef`s where necessary to make it compile.
Commit messages are formatted to be automatically squashed by `git rebase --autosquash`.

I'm not sure if the logging commit is too stricter (TARGET_LINUX), what I know for sure is that Darwin doesn't define CLOCK_MONOTHONIC.