nanosleep_time32.c 387 B

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