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
CMTimeRangeMake(start:duration:)CMTimeRangeMakeFromDictionary(_:)CMTimeRangeFromTimeToTime(start:end:)
Comparing Time Ranges
Inspecting Time Ranges
CMTIMERANGE_IS_EMPTY(_:)CMTIMERANGE_IS_INDEFINITE(_:)CMTIMERANGE_IS_INVALID(_:)CMTIMERANGE_IS_VALID(_:)CMTimeRangeGetEnd(_:)CMTimeRangeGetIntersection(_:otherRange:)CMTimeRangeGetUnion(_:otherRange:)
Utility Functions
CMTimeClampToRange(_:range:)CMTimeMapDurationFromRangeToRange(_:fromRange:toRange:)CMTimeMapTimeFromRangeToRange(_:fromRange:toRange:)CMTimeRangeCopyAsDictionary(_:allocator:)CMTimeRangeCopyDescription(allocator:range:)CMTimeRangeShow(_:)