how to use nanosleep() func