1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
3 // SPDX-License-Identifier: BSD-2-Clause
5 #include <common/time.h>
10 #include <wasi/core.h>
12 static_assert(CLOCKS_PER_SEC
== NSEC_PER_SEC
,
13 "Timestamp should need no conversion");
15 clock_t times(struct tms
*buffer
) {
17 __wasi_timestamp_t usertime
= 0;
18 (void)__wasi_clock_time_get(__WASI_CLOCK_PROCESS_CPUTIME_ID
, 0, &usertime
);
19 *buffer
= (struct tms
){.tms_utime
= usertime
};
22 __wasi_timestamp_t realtime
= 0;
23 (void)__wasi_clock_time_get(__WASI_CLOCK_MONOTONIC
, 0, &realtime
);