repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
sys/mman.h: add MAP_HUGE_16KB from linux v5.10
[musl.git]
/
compat
/
time32
/
gettimeofday_time32.c
blob
1f3ce68e3e66535f2f92654d85007b709501a87a
1
#include
"time32.h"
2
#include <sys/time.h>
3
#include <errno.h>
4
#include <stdint.h>
5
6
int
__gettimeofday_time32
(
struct
timeval32
*
tv32
,
void
*
tz
)
7
{
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
;
15
}
16
tv32
->
tv_sec
=
tv
.
tv_sec
;
17
tv32
->
tv_usec
=
tv
.
tv_usec
;
18
return
0
;
19
}