sys/mman.h: add MAP_HUGE_16KB from linux v5.10
[musl.git] / compat / time32 / gettimeofday_time32.c
blob1f3ce68e3e66535f2f92654d85007b709501a87a
1 #include "time32.h"
2 #include <sys/time.h>
3 #include <errno.h>
4 #include <stdint.h>
6 int __gettimeofday_time32(struct timeval32 *tv32, void *tz)
8 struct timeval tv;
9 if (!tv32) return 0;
10 int r = gettimeofday(&tv, 0);
11 if (r) return r;
12 if (tv.tv_sec < INT32_MIN || tv.tv_sec > INT32_MAX) {
13 errno = EOVERFLOW;
14 return -1;
16 tv32->tv_sec = tv.tv_sec;
17 tv32->tv_usec = tv.tv_usec;
18 return 0;