]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/sys/time/gettimeofday.c
Update to cloudlibc 8835639f27fc42d32096d59d294a0bbb857dc368.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / sys / time / gettimeofday.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <common/time.h>
6
7 #include <sys/time.h>
8
9 #include <wasi/core.h>
10
11 #ifdef __wasilibc_unmodified_upstream
12 int gettimeofday(struct timeval *restrict tp, ...) {
13 #else
14 int gettimeofday(struct timeval *restrict tp, void *tz) {
15 #endif
16 __wasi_timestamp_t ts = 0;
17 (void)__wasi_clock_time_get(__WASI_CLOCK_REALTIME, 1000, &ts);
18 *tp = timestamp_to_timeval(ts);
19 return 0;
20 }