One Logo Pool Ball
CoreMedia · IOS API REFERENCE

CMClock

class · iOS 6.0+ · SDK 27.1

class CMClock

Members (11)

init · iOS 6.0+

init

TypeScript
static init(object: CMClock): CMClock
Swift declaration
init(referencing object: CMClock)
method · iOS 13.0+

anchorTime

TypeScript
anchorTime(): { "anchorTime": CMTime; "referenceTime": CMTime }
Swift declaration
func anchorTime() throws -> (anchorTime: CMTime, referenceTime: CMTime)

Retrieves the current time from a clock and also the matching time from the clock's reference clock. To make practical use of this, you may need to know what the clock's reference clock is.

method · iOS 13.0+

invalidate

TypeScript
invalidate(): void
Swift declaration
func invalidate()

Makes the clock stop functioning. After invalidation, the clock will return errors from all APIs. This should only be called by the "owner" of the clock, who knows (for example) that some piece of hardware has gone away, and the clock will no longer work (and might even crash).

method · iOS 13.0+

mightDrift

TypeScript
mightDrift(otherClock: CMClock): boolean
Swift declaration
func mightDrift(relativeTo otherClock: CMClock) -> Bool

Indicates whether it is possible for the clock to drift relative to the `otherClock`.

get · iOS 13.0+

hostTimeClock

TypeScript
static get hostTimeClock(): CMClock
Swift declaration
static var hostTimeClock: CMClock { get }

The singleton clock logically identified with host time. On Mac OS X, the host time clock uses `mach_absolute_time` but returns a value with a large integer timescale (eg, nanoseconds).

static · iOS 13.0+

convertHostTimeToSystemUnits

TypeScript
static convertHostTimeToSystemUnits(hostTime: CMTime): number
Swift declaration
static func convertHostTimeToSystemUnits(_ hostTime: CMTime) -> UInt64

Converts a host time from `CMTime` to the host time's native units. This function performs a scale conversion, not a clock conversion. It can be more accurate than `CMTimeConvertScale` because the system units may have a non-integer timescale. On Mac OS X, this function converts to the units of `mach_absolute_time`.

static · iOS 13.0+

convertSystemUnitsToHostTime

TypeScript
static convertSystemUnitsToHostTime(systemUnits: number): CMTime
Swift declaration
static func convertSystemUnitsToHostTime(_ systemUnits: UInt64) -> CMTime

Converts a host time from native units to `CMTime`. The returned value will have a large integer timescale (eg, nanoseconds). This function handles situations where host time's native units use a non-integer timescale. On Mac OS X, this function converts from the units of `mach_absolute_time`.

method · iOS 27.0+

nextPreferredStartTimePattern

TypeScript
nextPreferredStartTimePattern(): (CMClock_StartTimePattern) | null
Swift declaration
func nextPreferredStartTimePattern() -> CMClock.StartTimePattern?

Returns the pattern of preferred start times, such as for synchronization with an external genlock signal. When a genlock signal is present and disciplined, this function returns a matched time pair in the near future and the delta between successive times.

get · iOS 27.0+

implementsPreferredStartTimePattern

TypeScript
get implementsPreferredStartTimePattern(): boolean
Swift declaration
var implementsPreferredStartTimePattern: Bool { get }

Indicates whether this clock implements preferred start time patterns.

get · iOS 13.0+

time

TypeScript
get time(): CMTime
Swift declaration
var time: CMTime { get }

The current time.

get · iOS 13.0+

typeID

TypeScript
static get typeID(): number
Swift declaration
static var typeID: CFTypeID { get }

The `CFTypeID` corresponding to `CMClock`.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CMClock.rate(relativeTo:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

CMClock.rateAndAnchorTime(relativeTo:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

CMClock.convertTime(_:to:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

CMClock.mightDrift(relativeTo:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

All CoreMedia types →