Implement nanosleep.

This is used by libcxx.