Use correct time library depending on target platform.

librt doesn't exist on apple platforms, so detect that
and use mach time instead.