blob: c7e1a609e7b21c6fbd8b0544e6fcc660261f1898 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <common/clock.h>
#include <common/time.h>
#include <wasi/api.h>
#include <errno.h>
#include <time.h>
int __clock_gettime(clockid_t clock_id, struct timespec *tp) {
__wasi_timestamp_t ts;
__wasi_errno_t error = __wasi_clock_time_get(clock_id->id, 1, &ts);
if (error != 0) {
errno = error;
return -1;
}
*tp = timestamp_to_timespec(ts);
return 0;
}
weak_alias(__clock_gettime, clock_gettime);
|