refactor thrd_sleep and nanosleep in terms of clock_nanosleep