Function

CMTimeMakeWithSeconds(_:preferredTimescale:)

Makes a CMTime from a Float64 number of seconds, and a preferred timescale.

Declaration

func CMTimeMakeWithSeconds(_ seconds: Float64, preferredTimescale: Int32) -> CMTime

Parameters

seconds

Initializes the seconds field of the resulting CMTime.

preferredTimeScale

Initializes the preferredTimeScale field of the resulting CMTime.

Return Value

The resulting CMTime.

Discussion

The epoch of the result will be zero. If preferredTimeScale is <= 0, the result will be an invalid CMTime. If the preferred timescale will cause an overflow, the timescale will be halved repeatedly until the overflow goes away, or the timescale is 1. If it still overflows at that point, the result will be +/- infinity. The hasBeenRounded flag will be set if the result, when converted back to seconds, is not exactly equal to the original seconds value.

See Also

Creating Times

init()

Initializes a new CMTime equal to kCMTimeInvalid.

init(seconds: Double, preferredTimescale: CMTimeScale)

Makes a CMTime from a Double number of seconds, and a preferred timescale.

init(value: CMTimeValue, timescale: CMTimeScale)

Makes a valid CMTime with value and timescale. Epoch is implied to be 0.

func CMTimeMake(value: Int64, timescale: Int32) -> CMTime

Makes a valid CMTime with value and timescale. Epoch is implied to be 0.

func CMTimeMakeFromDictionary(CFDictionary?) -> CMTime

Reconstitutes a CMTime struct from a CFDictionary previously created by CMTimeCopyAsDictionary(_:allocator:).