QMediaTimeRange::Interval Struct | Qt Multimedia | Qt 6.11.1
Description: The QMediaTimeRange::Interval class represents a time interval with integer precision.

- Qt 6.11
- Qt Multimedia
- C++ Classes
- QtMultimedia
- Interval
- Qt 6.11.1 Reference Documentation

# QMediaTimeRange::Interval Struct

struct QMediaTimeRange::Interval

The QMediaTimeRange::Interval class represents a time interval with integer precision. More...

- List of all members, including inherited members

## Public Functions

| Interval(qint64 start, qint64 end)
bool | contains(qint64 time) const
qint64 | end() const
bool | isNormal() const
QMediaTimeRange::Interval | normalized() const
qint64 | start() const
QMediaTimeRange::Interval | translated(qint64 offset) const

## Related Non-Members

bool | operator!=(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)
bool | operator==(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)

## Detailed Description

An interval is specified by an inclusive start() and end() time. These must be set in the constructor, as this is an immutable class. The specific units of time represented by the class have not been defined - it is suitable for any times which can be represented by a signed 64 bit integer.

The isNormal() method determines if a time interval is normal (a normal time interval has start() <= end()). A normal interval can be received from an abnormal interval by calling the normalized() method.

The contains() method determines if a specified time lies within the time interval.

The translated() method returns a time interval which has been translated forwards or backwards through time by a specified offset.

See also QMediaTimeRange.

## Member Function Documentation

### `[explicit constexpr noexcept]` Interval::Interval(qint64 start, qint64 end)

Constructs an interval with the specified start and end times.

### `[constexpr noexcept]` bool Interval::contains(qint64 time) const

Returns true if the time interval contains the specified time. That is, start() <= time <= end().

### `[constexpr noexcept]` qint64 Interval::end() const

Returns the end time of the interval.

See also start().

### `[constexpr noexcept]` bool Interval::isNormal() const

Returns true if this time interval is normal. A normal time interval has start() <= end().

See also normalized().

### `[constexpr]` QMediaTimeRange::Interval Interval::normalized() const

Returns a normalized version of this interval.

If the start() time of the interval is greater than the end() time, then the returned interval has the start and end times swapped.

### `[constexpr noexcept]` qint64 Interval::start() const

Returns the start time of the interval.

See also end().

### `[constexpr]` QMediaTimeRange::Interval Interval::translated(qint64 offset) const

Returns a copy of this time interval, translated by a value of offset. An interval can be moved forward through time with a positive offset, or backward through time with a negative offset.

## Related Non-Members

### `[constexpr noexcept]` bool operator!=(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)

Returns true if lhs is not exactly equal to rhs.

### `[constexpr noexcept]` bool operator==(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)

Returns true if lhs is exactly equal to rhs.