merged addfriend with self
only use CLOCK_MONOTONIC_RAW if it is defined