1
0

thrd_sleep_time32.c 410 B

12345678910111213141516
  1. #include "time32.h"
  2. #include <time.h>
  3. #include <threads.h>
  4. #include <errno.h>
  5. int __thrd_sleep_time32(const struct timespec32 *req32, struct timespec32 *rem32)
  6. {
  7. struct timespec rem;
  8. int ret = thrd_sleep((&(struct timespec){
  9. .tv_sec = req32->tv_sec, .tv_nsec = req32->tv_nsec}), &rem);
  10. if (ret<0 && errno==EINTR && rem32) {
  11. rem32->tv_sec = rem.tv_sec;
  12. rem32->tv_nsec = rem.tv_nsec;
  13. }
  14. return ret;
  15. }