sandboxed-system-primitives: make CPT/TCT clock ids optional (#1126)

NuttX doesn't have them.
This commit is contained in:
YAMAMOTO Takashi 2022-04-27 15:24:02 +09:00 committed by GitHub
parent d7097fbce8
commit 2fe83e29cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,15 +181,19 @@ convert_clockid(__wasi_clockid_t in, clockid_t *out)
case __WASI_CLOCK_MONOTONIC:
*out = CLOCK_MONOTONIC;
return true;
#if defined(CLOCK_PROCESS_CPUTIME_ID)
case __WASI_CLOCK_PROCESS_CPUTIME_ID:
*out = CLOCK_PROCESS_CPUTIME_ID;
return true;
#endif
case __WASI_CLOCK_REALTIME:
*out = CLOCK_REALTIME;
return true;
#if defined(CLOCK_THREAD_CPUTIME_ID)
case __WASI_CLOCK_THREAD_CPUTIME_ID:
*out = CLOCK_THREAD_CPUTIME_ID;
return true;
#endif
default:
return false;
}