zx_clock_get_details

总结

获取时钟当前状态的所有低级别详细信息。

声明

#include <zircon/syscalls.h>

zx_status_t zx_clock_get_details(zx_handle_t handle,
                                 uint64_t options,
                                 void* details);

权限

handle 必须为 ZX_OBJ_TYPE_CLOCK 类型,且具有 ZX_RIGHT_READ

说明

获取时钟对象的细粒度。如需了解报告的详细信息,请参阅时钟。目前,仅为时钟定义一种详细信息结构 zx_clock_details_v1_t。用户必须使用 options 参数指定结构的版本,并通过 details 提供至少 sizeof(zx_clock_details_v1_t) 字节的存储空间。例如:

#include <zircon/syscalls.h>
#include <zircon/syscalls/clock.h>

void GetSomeDetails(zx_handle_t the_clock) {
  zx_clock_details_v1_t details;
  zx_status_t status;

  status = zx_clock_get_details(the_clock, ZX_CLOCK_ARGS_VERSION(1), &details);
  if (status == ZX_OK) {
    // Do great things with our details.
  }
}

返回值

成功后,会返回 ZX_OK 以及存储在 details out 参数中的时钟详细信息。

错误

  • ZX_ERR_BAD_HANDLEhandle 是无效句柄,或者是非 ZX_OBJ_TYPE_CLOCK 对象类型的句柄。
  • ZX_ERR_ACCESS_DENIEDhandle 缺少 ZX_RIGHT_READ 右侧。
  • ZX_ERR_INVALID_ARGSoptions 有信号的详情结构的版本无效,或通过 details 传递的结构的指针错误。

另请参阅