CMClock

A reference clock used to synchronize applications and devices.

Overview

The CMSync API provides a reference clock that you can use to synchronize applications and devices. This API also provides functions to monitor relative drift between CMClocks and functions that are associated with timer services.

Topics

Accessing the Host Clock

func CMClockGetHostTimeClock() -> CMClock

Returns a reference to the singleton clock logically identified with host time.

Accessing and Converting Time

func CMClockGetTime(CMClock) -> CMTime

Retrieves the current time from a clock.

func CMClockGetAnchorTime(CMClock, clockTimeOut: UnsafeMutablePointer<CMTime>, referenceClockTimeOut: UnsafeMutablePointer<CMTime>) -> OSStatus

Retrieves the current time from a clock and also the matching time from the clock's reference clock.

func CMClockConvertHostTimeToSystemUnits(CMTime) -> UInt64

Converts a host time from CMTime to the host time's native units.

func CMClockMakeHostTimeFromSystemUnits(UInt64) -> CMTime

Converts a host time from native units to CMTime.

Utility Functions

func CMClockGetTypeID() -> CFTypeID

Returns the CFTypeID of the CMClock.

func CMClockMightDrift(CMClock, otherClock: CMClock) -> Bool

Returns a Boolean that indicates whether it is possible for two clocks to drift relative to each other.

func CMClockInvalidate(CMClock)

Makes the clock stop functioning.

func CMSyncGetRelativeRate(CMClockOrTimebase, relativeTo: CMClockOrTimebase) -> Float64

Queries the relative rate of one timebase or clock relative to another timebase or clock.

func CMSyncGetRelativeRateAndAnchorTime(CMClockOrTimebase, relativeTo: CMClockOrTimebase, relativeRateOut: UnsafeMutablePointer<Float64>?, anchorTimeOut: UnsafeMutablePointer<CMTime>?, relativeToAnchorTimeOut: UnsafeMutablePointer<CMTime>?) -> OSStatus

Queries the relative rate of one timebase or clock relative to another timebase or clock and the times of each timebase or clock at which the relative rate went into effect.

func CMSyncConvertTime(CMTime, from: CMClockOrTimebase, to: CMClockOrTimebase) -> CMTime

Converts a time from one timebase or clock to another timebase or clock.

func CMSyncMightDrift(CMClockOrTimebase, CMClockOrTimebase) -> Bool

Returns a Boolean indicating whether it is possible for one timebase/clock to drift relative to the other.

func CMSyncGetTime(CMClockOrTimebase) -> CMTime

A helper function to get time from a clock or timebase.

Data Types

class CMClock

A timing source object.

typealias CMClockOrTimebase

Used in argument lists and function results to indicate that either may be passed

Constants

CMClock Error Codes

The following constants represents the errors in Core Media clock operations.

CMTimebase error codes

The following constants represents errors in core media time base operations.

CMSync error codes

These following constants represents error codes returned by core media synch operations.

Timebase Notifications

Keys that represent time base notifications.

See Also

Media Synchronization

CMAudioClock

A specialized reference clock used to synchronize with audio sources.

CMTimebase

A model of a timeline under application control.