<!--
{
  "documentType" : "article",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/cmtime-api",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CMTime"
}
-->

# CMTime

A structure that represents time.

## Discussion

Core Media represents time as a rational value, with a time value as the numerator and timescale as the denominator. The structure can represent a specific numeric time in the media timeline, and can also represent nonnumeric values like invalid and indefinite times or positive and negative infinity.

## Topics

### Creating a Time

[`CMTimeMake`](/documentation/CoreMedia/CMTimeMake(value:timescale:))

Creates a time with a value and timescale.

[`CMTimeMakeWithEpoch`](/documentation/CoreMedia/CMTimeMakeWithEpoch(value:timescale:epoch:))

Creates a time with a value, timescale, and epoch.

[`CMTimeMakeWithSeconds`](/documentation/CoreMedia/CMTimeMakeWithSeconds(_:preferredTimescale:))

Creates a time that represents a number of seconds in a preferred timescale.

[`CMTimeMakeFromDictionary`](/documentation/CoreMedia/CMTimeMakeFromDictionary(_:))

Creates a time from a dictionary representation of its fields.

### Inspecting a Time

[`CMTimeGetSeconds`](/documentation/CoreMedia/CMTimeGetSeconds(_:))

Returns a representation of the time in seconds.

[`CMTimeAbsoluteValue`](/documentation/CoreMedia/CMTimeAbsoluteValue(_:))

Returns the absolute value of a time.

[`CMTIME_IS_VALID(_:)`](/documentation/CoreMedia/CMTIME_IS_VALID(_:))

Returns a Boolean value that indicates whether a given time is valid.

[`CMTIME_IS_INVALID(_:)`](/documentation/CoreMedia/CMTIME_IS_INVALID(_:))

Returns a Boolean value that indicates whether a given time is invalid.

[`CMTIME_IS_POSITIVEINFINITY(_:)`](/documentation/CoreMedia/CMTIME_IS_POSITIVEINFINITY(_:))

Returns a Boolean value that indicates whether a given time is positive infinity.

[`CMTIME_IS_NEGATIVEINFINITY(_:)`](/documentation/CoreMedia/CMTIME_IS_NEGATIVEINFINITY(_:))

Returns a Boolean value that indicates whether a given time is negative infinity.

[`CMTIME_IS_INDEFINITE(_:)`](/documentation/CoreMedia/CMTIME_IS_INDEFINITE(_:))

Returns a Boolean value that indicates whether a given time is indefinite.

[`CMTIME_IS_NUMERIC(_:)`](/documentation/CoreMedia/CMTIME_IS_NUMERIC(_:))

Returns a Boolean value that indicates whether a given time is numeric.

[`CMTIME_HAS_BEEN_ROUNDED(_:)`](/documentation/CoreMedia/CMTIME_HAS_BEEN_ROUNDED(_:))

Returns a Boolean value that indicates whether the system rounded the time value.

[`CMTIME_IS_VALID`](/documentation/CoreMedia/CMTIME_IS_VALID)

Returns a Boolean value that indicates whether a time is valid.

[`CMTIME_IS_INVALID`](/documentation/CoreMedia/CMTIME_IS_INVALID)

Returns a Boolean value that indicates whether a time is invalid.

[`CMTIME_IS_POSITIVE_INFINITY`](/documentation/CoreMedia/CMTIME_IS_POSITIVE_INFINITY)

Returns a Boolean value that indicates whether a time is positive infinity.

[`CMTIME_IS_NEGATIVE_INFINITY`](/documentation/CoreMedia/CMTIME_IS_NEGATIVE_INFINITY)

Returns a Boolean value that indicates whether a time is negative infinity.

[`CMTIME_IS_INDEFINITE`](/documentation/CoreMedia/CMTIME_IS_INDEFINITE)

Returns a Boolean value that indicates whether a time is indefinite.

[`CMTIME_IS_NUMERIC`](/documentation/CoreMedia/CMTIME_IS_NUMERIC)

Returns a Boolean value that indicates whether a time is numeric.

[`CMTIME_HAS_BEEN_ROUNDED`](/documentation/CoreMedia/CMTIME_HAS_BEEN_ROUNDED)

Returns a Boolean value that indicates whether the system rounded the time.

### Performing Time Calculations

[`CMTimeAdd`](/documentation/CoreMedia/CMTimeAdd(_:_:))

Returns the sum of two times.

[`CMTimeSubtract`](/documentation/CoreMedia/CMTimeSubtract(_:_:))

Returns the difference between two times.

[`CMTimeMultiply`](/documentation/CoreMedia/CMTimeMultiply(_:multiplier:))

Returns the result of multiplying a time by an integer multiplier.

[`CMTimeMultiplyByFloat64`](/documentation/CoreMedia/CMTimeMultiplyByFloat64(_:multiplier:))

Returns the result of multiplying a time by a floating-point multiplier.

[`CMTimeMultiplyByRatio`](/documentation/CoreMedia/CMTimeMultiplyByRatio(_:multiplier:divisor:))

Returns the result of multiplying a time by an integer multiplier, and then dividing the result by the divisor.

### Changing the Timescale

[`CMTimeConvertScale`](/documentation/CoreMedia/CMTimeConvertScale(_:timescale:method:))

Converts the source time to a new timescale using the specified rounding method.

[`CMTimeRoundingMethod`](/documentation/CoreMedia/CMTimeRoundingMethod)

An enumeration of rounding methods to use when performing time calculations.

### Comparing Times

[`CMTIME_COMPARE_INLINE`](/documentation/CoreMedia/CMTIME_COMPARE_INLINE)

Returns a Boolean value that indicates whether the specified comparison is true.

[`CMTimeCompare`](/documentation/CoreMedia/CMTimeCompare(_:_:))

Returns the numerical relationship of two times.

[`CMTimeMaximum`](/documentation/CoreMedia/CMTimeMaximum(_:_:))

Returns the greater of two time values.

[`CMTimeMinimum`](/documentation/CoreMedia/CMTimeMinimum(_:_:))

Returns the lesser of two time values.

### Representing Times

[`CMTimeShow`](/documentation/CoreMedia/CMTimeShow(_:))

Prints a description of the time to the console.

[`CMTimeCopyDescription`](/documentation/CoreMedia/CMTimeCopyDescription(allocator:time:))

Creates a string representation of the time.

[`CMTimeCopyAsDictionary`](/documentation/CoreMedia/CMTimeCopyAsDictionary(_:allocator:))

Creates a dictionary representation of the time.

### Data Types

[`CMTime`](/documentation/CoreMedia/CMTime)

A structure that represents time.

[`CMTimeValue`](/documentation/CoreMedia/CMTimeValue)

An integer time value.

[`CMTimeScale`](/documentation/CoreMedia/CMTimeScale)

An integer timescale.

[`CMTimeEpoch`](/documentation/CoreMedia/CMTimeEpoch)

An epoch for a time.

[`CMTimeFlags`](/documentation/CoreMedia/CMTimeFlags)

A structure that defines the flags for a time value.

### Constants

[Time](/documentation/CoreMedia/cmtime-time)

Defined time values.

[Timescale](/documentation/CoreMedia/cmtime-timescale)

Defined timescale values.

[Dictionary Keys](/documentation/CoreMedia/cmtime-dictionary-keys)

Keys to use when working with dictionary representations of time.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)