Duration
SwiftClock.swift:54struct Duration
struct Duration
import MachCore
The core module for interacting with the Mach kernel.
class Clock
A clock.
struct Mach
The Mach kernel.
convenience init(_ type: Mach.ClockType, onHost host: Mach.Host) throws
Obtains the given clock.
static var calendar: Clock { get throws }
The calendar clock in the current host.
static var system: Clock { get throws }
The system clock in the current host.
var clockAttributes: Mach.ClockAttributeManager { get }
The clock attributes.
var minimumResolution: Duration { get }
Unsafe. The minimum resolution of the clock.
var now: Instant { get }
Unsafe. The current time of the clock.
var time: mach_timespec_t { get throws }
The current time of the clock.
@discardableResult func sleep(for time: mach_timespec_t) throws -> mach_timespec_t
Sleeps on the clock for the given time.
@discardableResult func sleep(until time: mach_timespec_t) throws -> mach_timespec_t
Sleeps on the clock until the given time.
func sleep(until time: Instant, tolerance: Duration?) async
Unsafe. Sleeps until a given time.
struct Instant
protocol AdditiveArithmetic : Equatable
A type with values that support addition and subtraction.
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol DurationProtocol : AdditiveArithmetic, Comparable, Sendable
A type that defines a duration for a given InstantProtocol
type.
protocol Equatable
A type that can be compared for value equality.
protocol Sendable
init(_ value: mach_timespec)
static var zero: `Self` { get }
let value: mach_timespec
static func != (lhs: `Self`, rhs: `Self`) -> Bool
static func * (lhs: `Self`, rhs: Int) -> Mach.Clock.Duration
static func + (lhs: `Self`, rhs: `Self`) -> Mach.Clock.Duration
static func - (lhs: `Self`, rhs: `Self`) -> Mach.Clock.Duration
static func / (lhs: `Self`, rhs: Int) -> Mach.Clock.Duration
static func / (lhs: `Self`, rhs: `Self`) -> Double
static func < (lhs: `Self`, rhs: `Self`) -> Bool
static func == (lhs: `Self`, rhs: `Self`) -> Bool
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func *= (lhs: inout Self, rhs: Int)
static func + (x: Self) -> Self
Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self)
static func -= (lhs: inout Self, rhs: Self)
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: inout Self, rhs: Int)
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.