Implement os_time_get_boot_microsecond() for sgx platform (#818)

This commit is contained in:
Wenyong Huang 2021-11-06 15:58:21 +08:00 committed by GitHub
parent c591610111
commit 9424dad56a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,10 +28,18 @@ ocall_clock_nanosleep(int *p_ret, unsigned clock_id, int flags,
uint64
os_time_get_boot_microsecond()
{
/* TODO */
#ifndef SGX_DISABLE_WASI
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
return 0;
}
return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
#else
return 0;
#endif
}
#ifndef SGX_DISABLE_WASI
int