// Copyright (c) 2017-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

include::{generated}/meta/XR_KHR_convert_timespec_time.adoc[]

*Last Modified Date*::
   2019-01-24
*IP Status*::
    No known IP claims.
*Contributors*::
    Paul Pedriana, Oculus

*Overview*

This extension provides two functions for converting between timespec
monotonic time and basetype:XrTime.
The flink:xrConvertTimespecTimeToTimeKHR function converts from timespec
time to basetype:XrTime, while the flink:xrConvertTimeToTimespecTimeKHR
function converts basetype:XrTime to timespec monotonic time.
The primary use case for this functionality is to be able to synchronize
events between the local system and the OpenXR system.

*New Object Types*

*New Flag Types*

*New Enum Constants*

*New Enums*

*New Structures*

*New Functions*

[open,refpage='xrConvertTimespecTimeToTimeKHR',type='protos',desc='Convert timespec monotonic time to XrTime',xrefs='XrTime']
--
To convert from timespec monotonic time to basetype:XrTime, call:

include::{generated}/api/protos/xrConvertTimespecTimeToTimeKHR.adoc[]

.Parameter Descriptions
****
* pname:instance is an slink:XrInstance handle previously created with
  flink:xrCreateInstance.
* pname:timespecTime is a code:timespec obtained from code:clock_gettime
  with code:CLOCK_MONOTONIC.
* pname:time is the resulting basetype:XrTime that is equivalent to the
  pname:timespecTime.
****

The flink:xrConvertTimespecTimeToTimeKHR function converts a time obtained
by the code:clock_gettime function to the equivalent basetype:XrTime.

If the output pname:time cannot represent the input pname:timespecTime, the
runtime must: return ename:XR_ERROR_TIME_INVALID.

include::{generated}/validity/protos/xrConvertTimespecTimeToTimeKHR.adoc[]
--

[open,refpage='xrConvertTimeToTimespecTimeKHR',type='protos',desc='Convert XrTime to timespec monotonic time',xrefs='XrTime']
--
To convert from basetype:XrTime to timespec monotonic time, call:

include::{generated}/api/protos/xrConvertTimeToTimespecTimeKHR.adoc[]

.Parameter Descriptions
****
* pname:instance is an slink:XrInstance handle previously created with
  flink:xrCreateInstance.
* pname:time is an basetype:XrTime.
* pname:timespecTime is the resulting timespec time that is equivalent to a
  code:timespec obtained from code:clock_gettime with code:CLOCK_MONOTONIC.
****

The flink:xrConvertTimeToTimespecTimeKHR function converts an
basetype:XrTime to time as if generated by code:clock_gettime.

If the output pname:timespecTime cannot represent the input pname:time, the
runtime must: return ename:XR_ERROR_TIME_INVALID.

include::{generated}/validity/protos/xrConvertTimeToTimespecTimeKHR.adoc[]
--

*Issues*

*Version History*

* Revision 1, 2019-01-24 (Paul Pedriana)
** Initial draft

