Instant
A continuous point in time used for ContinuousClock
.
- iOS
- 16.0+
- macOS
- 13.0+
- tvOS
- 16.0+
- watchOS
- 9.0+
struct Instant
A continuous point in time used for ContinuousClock
.
struct Instant
import _Concurrency
struct ContinuousClock
A clock that measures time that always increments and does not stop incrementing while the system is asleep.
init()
static var now: ContinuousClock.Instant { get }
The current continuous instant.
var minimumResolution: Duration { get }
The minimum non-zero resolution between any two calls to now
.
var now: ContinuousClock.Instant { get }
The current continuous instant.
func sleep(until deadline: ContinuousClock.Instant, tolerance: Duration? = nil) async throws
Suspend task execution until a given deadline within a tolerance. If no tolerance is specified then the system may adjust the deadline to coalesce CPU wake-ups to more efficiently process the wake-ups in a more power efficient manner.
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol InstantProtocol<Duration> : Comparable, Hashable, Sendable
protocol Sendable
A thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
init(from decoder: any Decoder) throws
static var now: ContinuousClock.Instant { get }
static func + (lhs: ContinuousClock.Instant, rhs: Duration) -> ContinuousClock.Instant
static func += (lhs: inout ContinuousClock.Instant, rhs: Duration)
static func - (lhs: ContinuousClock.Instant, rhs: Duration) -> ContinuousClock.Instant
static func - (lhs: ContinuousClock.Instant, rhs: ContinuousClock.Instant) -> Duration
static func -= (lhs: inout ContinuousClock.Instant, rhs: Duration)
static func < (lhs: ContinuousClock.Instant, rhs: ContinuousClock.Instant) -> Bool
static func == (lhs: ContinuousClock.Instant, rhs: ContinuousClock.Instant) -> Bool
func advanced(by duration: Duration) -> ContinuousClock.Instant
func duration(to other: ContinuousClock.Instant) -> Duration
func hash(into hasher: inout Hasher)
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func ... (minimum: Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.