---
title: CMTimeRange
framework: Core Media
role: collectionGroup
role_heading: API Collection
path: coremedia/cmtimerange-api
---

# CMTimeRange

A structure that represents a range of time.

## Overview

Overview This document describes the API for creating and manipulating CMTimeRange structures. The system represents a CMTimeRange as a non-opaque, mutable structure by using two CMTime values that specify the start time and duration of the range. A time range doesn’t include the end time because you calculate it by adding the duration to the start time. // An expression that evaluates to false. CMTimeRangeContainsTime(range, CMTimeRangeGetEnd(range)) Convert CMTimeRanges to and from CFDictionaries (see CFDictionary) using CMTimeRangeCopyAsDictionary(_:allocator:) and CMTimeRangeMakeFromDictionary(_:) to use in annotations and various Core Foundation containers. The epoch in a CMTime that represents a duration must be 0, and the value must be nonnegative. The epoch in a CMTime that represents a timestamp can be nonzero, but functions (such as CMTimeRangeGetUnion(_:otherRange:)) can only perform operations on ranges whose start fields have the same epoch. CMTimeRanges can’t span different epochs. For information about additional functions for managing dates and times, see Time Utilities.

## Topics

### Creating Time Ranges

- [CMTimeRangeMake(start:duration:)](coremedia/cmtimerangemake(start:duration:).md)
- [CMTimeRangeMakeFromDictionary(_:)](coremedia/cmtimerangemakefromdictionary(_:).md)
- [CMTimeRangeFromTimeToTime(start:end:)](coremedia/cmtimerangefromtimetotime(start:end:).md)

### Comparing Time Ranges

- [CMTimeRangeEqual(_:_:)](coremedia/cmtimerangeequal(_:_:).md)
- [CMTimeRangeContainsTime(_:time:)](coremedia/cmtimerangecontainstime(_:time:).md)
- [CMTimeRangeContainsTimeRange(_:otherRange:)](coremedia/cmtimerangecontainstimerange(_:otherrange:).md)

### Inspecting Time Ranges

- [CMTIMERANGE_IS_EMPTY(_:)](coremedia/cmtimerange_is_empty(_:).md)
- [CMTIMERANGE_IS_INDEFINITE(_:)](coremedia/cmtimerange_is_indefinite(_:).md)
- [CMTIMERANGE_IS_INVALID(_:)](coremedia/cmtimerange_is_invalid(_:).md)
- [CMTIMERANGE_IS_VALID(_:)](coremedia/cmtimerange_is_valid(_:).md)
- [CMTimeRangeGetEnd(_:)](coremedia/cmtimerangegetend(_:).md)
- [CMTimeRangeGetIntersection(_:otherRange:)](coremedia/cmtimerangegetintersection(_:otherrange:).md)
- [CMTimeRangeGetUnion(_:otherRange:)](coremedia/cmtimerangegetunion(_:otherrange:).md)

### Utility Functions

- [CMTimeClampToRange(_:range:)](coremedia/cmtimeclamptorange(_:range:).md)
- [CMTimeMapDurationFromRangeToRange(_:fromRange:toRange:)](coremedia/cmtimemapdurationfromrangetorange(_:fromrange:torange:).md)
- [CMTimeMapTimeFromRangeToRange(_:fromRange:toRange:)](coremedia/cmtimemaptimefromrangetorange(_:fromrange:torange:).md)
- [CMTimeRangeCopyAsDictionary(_:allocator:)](coremedia/cmtimerangecopyasdictionary(_:allocator:).md)
- [CMTimeRangeCopyDescription(allocator:range:)](coremedia/cmtimerangecopydescription(allocator:range:).md)
- [CMTimeRangeShow(_:)](coremedia/cmtimerangeshow(_:).md)

### Data Types

- [CMTimeRange](coremedia/cmtimerange.md)

### Constants

- [Dictionary Keys](coremedia/cmtimerange-dictionary-keys.md)
- [Pre-Specified Time Ranges](coremedia/pre-specified-time-ranges.md)

## See Also

### Time Representation

- [CMTime](coremedia/cmtime-api.md)
- [CMTimeMapping](coremedia/cmtimemapping-api.md)
