Time
Written by
Updated at November 5, 2026
public struct Time
Timestamp within a media stream.
Contents
This page displays:
Description
Used to set playback position, duration representation, and buffering ranges. Supports arithmetic operations and comparisons.
Protocol match
The structure matches the AdditiveArithmetic and Comparable protocols.
Properties
|
Name |
Type |
Description |
|
|
|
Value in seconds in |
|
|
|
Zero time position. |
Initializers
public init(sec time: TimeInterval)
Creates a timestamp from a value in seconds.
Parameters:
time: Time in seconds.
public init(ms time: Int64)
Creates a timestamp from a value in milliseconds.
Parameters:
time: Time in milliseconds.
Methods
public static func - (lhs: Time, rhs: Time) -> Time
Deducts one time value from another.
public static func + (lhs: Time, rhs: Time) -> Time
Sums two time values.
Examples
let startTime = Time(sec: 30)
let offset = Time(ms: 500)
let result = startTime + offset
await player.seek(to: startTime)