Instance Method

itemTime(forHostTime:)

Converts a host time, specified in seconds, to the item’s timebase.

Declaration

func itemTime(forHostTime hostTimeInSeconds: CFTimeInterval) -> CMTime

Parameters

hostTimeInSeconds

A host time value, specified in seconds. For example, you might specify the time value returned by the CACurrentMediaTime() function or the timestamp from a CADisplayLink object for this parameter.

Return Value

The equivalent time in the item’s timebase.

Discussion

The timestamp associated with a CADisplayLink object represents the time of the most recent screen refresh, which is usually a time in the past. If you want to find the time associated with the next screen refresh, you need to increment the timestamp by the value in the display link’s duration property.

See Also

Converting Time Information

func itemTime(forMachAbsoluteTime: Int64) -> CMTime

Converts a Mach host time to the item’s timebase.

func itemTime(for: CVTimeStamp) -> CMTime

Converts a Core Video timestamp to the item’s timebase.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software