1570af302Sopenharmony_ci#include "time32.h" 2570af302Sopenharmony_ci#include <time.h> 3570af302Sopenharmony_ci#include <threads.h> 4570af302Sopenharmony_ci#include <errno.h> 5570af302Sopenharmony_ci 6570af302Sopenharmony_ciint __thrd_sleep_time32(const struct timespec32 *req32, struct timespec32 *rem32) 7570af302Sopenharmony_ci{ 8570af302Sopenharmony_ci struct timespec rem; 9570af302Sopenharmony_ci int ret = thrd_sleep((&(struct timespec){ 10570af302Sopenharmony_ci .tv_sec = req32->tv_sec, .tv_nsec = req32->tv_nsec}), &rem); 11570af302Sopenharmony_ci if (ret<0 && errno==EINTR && rem32) { 12570af302Sopenharmony_ci rem32->tv_sec = rem.tv_sec; 13570af302Sopenharmony_ci rem32->tv_nsec = rem.tv_nsec; 14570af302Sopenharmony_ci } 15570af302Sopenharmony_ci return ret; 16570af302Sopenharmony_ci} 17