1 #define _WASI_EMULATED_PROCESS_CLOCKS
2 #include <sys/resource.h>
6 #include <common/time.h>
8 // `clock` is a weak symbol so that application code can override it.
9 // We want to use the function in libc, so use the libc-internal name.
10 clock_t __clock(void);
12 int getrusage(int who
, struct rusage
*r_usage
) {
15 __wasi_timestamp_t usertime
= __clock();
16 *r_usage
= (struct rusage
) {
17 .ru_utime
= timestamp_to_timeval(usertime
)
22 *r_usage
= (struct rusage
) {};