---
title: CMTime
framework: coremedia
role: symbol
role_heading: Structure
path: coremedia/cmtime
---

# CMTime

A structure that represents time.

## Declaration

```swift
struct CMTime
```

## Overview

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:)](coremedia/cmtime/init(value:timescale:).md)
- [init(value:timescale:flags:epoch:)](coremedia/cmtime/init(value:timescale:flags:epoch:).md)
- [init(seconds:preferredTimescale:)](coremedia/cmtime/init(seconds:preferredtimescale:).md)
- [init()](coremedia/cmtime/init().md)

### Inspecting a Time

- [seconds](coremedia/cmtime/seconds.md)
- [hasBeenRounded](coremedia/cmtime/hasbeenrounded.md)
- [isValid](coremedia/cmtime/isvalid.md)
- [isNumeric](coremedia/cmtime/isnumeric.md)
- [isIndefinite](coremedia/cmtime/isindefinite.md)
- [isPositiveInfinity](coremedia/cmtime/ispositiveinfinity.md)
- [isNegativeInfinity](coremedia/cmtime/isnegativeinfinity.md)

### Performing Time Calcualtions

- [+(_:_:)](coremedia/cmtime/+(_:_:).md)
- [-(_:_:)](coremedia/cmtime/-(_:_:).md)

### Changing the Timescale

- [convertScale(_:method:)](coremedia/cmtime/convertscale(_:method:).md)
- [CMTimeRoundingMethod](coremedia/cmtimeroundingmethod.md)

### Accessing Time Values

- [value](coremedia/cmtime/value.md)
- [timescale](coremedia/cmtime/timescale.md)
- [flags](coremedia/cmtime/flags.md)
- [epoch](coremedia/cmtime/epoch.md)

### Constants

- [zero](coremedia/cmtime/zero.md)
- [invalid](coremedia/cmtime/invalid.md)
- [indefinite](coremedia/cmtime/indefinite.md)
- [negativeInfinity](coremedia/cmtime/negativeinfinity.md)
- [positiveInfinity](coremedia/cmtime/positiveinfinity.md)

### Operators

- [!=(_:_:)](coremedia/cmtime/!=(_:_:).md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [CVAttachmentValueRepresentable](corevideo/cvattachmentvaluerepresentable.md)
- [Comparable](swift/comparable.md)
- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)

## See Also

### Data Types

- [CMTimeValue](coremedia/cmtimevalue.md)
- [CMTimeScale](coremedia/cmtimescale.md)
- [CMTimeEpoch](coremedia/cmtimeepoch.md)
- [CMTimeFlags](coremedia/cmtimeflags.md)
