Contents

CMTimeRange

A structure that represents a range of time.

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

Comparing Time Ranges

Inspecting Time Ranges

Utility Functions

Data Types

Constants

See Also

Time Representation