]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/time/time.c
Remove __wasilibc_unmodified_upstream markers from libc-bottom-half.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / time / time.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 <wasi/api.h>
8 #include <time.h>
9
10 time_t time(time_t *tloc) {
11 __wasi_timestamp_t ts = 0;
12 (void)__wasi_clock_time_get(__WASI_CLOCKID_REALTIME, NSEC_PER_SEC, &ts);
13 if (tloc != NULL)
14 *tloc = ts / NSEC_PER_SEC;
15 return ts / NSEC_PER_SEC;
16 }