<!--
{
  "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/CMTimeRange",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@SA@CMTimeRange"
  },
  "title" : "CMTimeRange"
}
-->

# CMTimeRange

A structure that represents a time range.

```
struct CMTimeRange
```

## Topics

### Creating Time Ranges

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

Creates an empty time range at zero.

[`init(start:duration:)`](/documentation/CoreMedia/CMTimeRange/init(start:duration:))

Creates a valid time range with a start time and duration.

[`init(start:end:)`](/documentation/CoreMedia/CMTimeRange/init(start:end:))

Creates a valid time range from a start and end time.

### Inspecting Time Ranges

[`start`](/documentation/CoreMedia/CMTimeRange/start)

The start time of the time range.

[`end`](/documentation/CoreMedia/CMTimeRange/end)

The end time of the time range.

[`duration`](/documentation/CoreMedia/CMTimeRange/duration)

The duration of the time range.

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

A Boolean value that indicates whether the time range is valid.

[`isEmpty`](/documentation/CoreMedia/CMTimeRange/isEmpty)

A Boolean value that indicates whether the time range is empty.

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

A Boolean value that indicates whether the time range is indefinite.

### Finding Elements

[`containsTime(_:)`](/documentation/CoreMedia/CMTimeRange/containsTime(_:))

Returns a Boolean value that indicates whether the time range contains a time.

[`containsTimeRange(_:)`](/documentation/CoreMedia/CMTimeRange/containsTimeRange(_:))

Returns a Boolean value that indicates whether the time range contains another time range.

### Combining Time Ranges

[`intersection(_:)`](/documentation/CoreMedia/CMTimeRange/intersection(_:))

Returns a new time range with the time elements that are common to both this time range and the given time range.

[`union(_:)`](/documentation/CoreMedia/CMTimeRange/union(_:))

Returns a new time range with the time elements of both this time range and the given time range.

### Constants

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

A constant for generating an empty time range at zero.

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

A constant for generating an invalid time range.



---

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)