github.com/afumu/libc@v0.0.6/musl/compat/time32/timespec_get_time32.c (about)

     1  #include "time32.h"
     2  #include <time.h>
     3  #include <errno.h>
     4  #include <stdint.h>
     5  
     6  int __timespec_get_time32(struct timespec32 *ts32, int base)
     7  {
     8  	struct timespec ts;
     9  	int r = timespec_get(&ts, base);
    10  	if (!r) return r;
    11  	if (ts.tv_sec < INT32_MIN || ts.tv_sec > INT32_MAX) {
    12  		errno = EOVERFLOW;
    13  		return 0;
    14  	}
    15  	ts32->tv_sec = ts.tv_sec;
    16  	ts32->tv_nsec = ts.tv_nsec;
    17  	return r;
    18  }