<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMTime",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@SA@CMTime"
  },
  "title" : "CMTime"
}
-->

# CMTime

A structure that represents time.

```
struct CMTime
```

## Overview

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

[`init(value:timescale:)`](/documentation/CoreMedia/CMTime/init(value:timescale:))

Creates a time with a value and timescale.

[`init(value:timescale:flags:epoch:)`](/documentation/CoreMedia/CMTime/init(value:timescale:flags:epoch:))

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

[`init(seconds:preferredTimescale:)`](/documentation/CoreMedia/CMTime/init(seconds:preferredTimescale:))

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

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

Creates a time with an invalid value.

### Inspecting a Time

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

A representation of the time in seconds.

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

A Boolean value that indicates whether the system rounded the time.

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

A Boolean value that indicates whether a time is valid.

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

A Boolean value that indicates whether a time is numeric.

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

A Boolean value that indicates whether a time is indefinite.

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

A Boolean value that indicates whether a time represents positive infinity.

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

A Boolean value that indicates whether a time represents negative infinity.

### Performing Time Calcualtions

[`+(_:_:)`](/documentation/CoreMedia/CMTime/+(_:_:))

Returns a new time that represents the sum of two times.

[`-(_:_:)`](/documentation/CoreMedia/CMTime/-(_:_:))

Returns a new time that represents the difference between two times.

### Changing the Timescale

[`convertScale(_:method:)`](/documentation/CoreMedia/CMTime/convertScale(_: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.

### Accessing Time Values

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

A time value that represents the numerator of a rational time.

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

A timescale that represents the denominator of a rational time.

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

The flags associated with a time.

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

The epoch of the time.

### Constants

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

A value that represents time zero.

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

A value that represents an invalid time.

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

A value that represents an indefinite time.

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

A value that represents negative infinity.

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

A value that represents positive infinity.



---

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)