Timer
public struct Timer: FileDescriptor
Timer is a file descriptor associated with a timer. See timerfd_create(2) for details.
-
The file descriptor for this timer.
Declaration
Swift
public let fileDescriptor: Int32
-
Sets the timer to trigger on the initial delay, and then at the specified interval. Returns the previously set timer delays.
Declaration
Swift
public func set(initial: TimeInterval, thenEach interval: TimeInterval = 0, flags: SetFlags = []) throws -> (initial: TimeInterval, interval: TimeInterval)
-
Unsets the timer, so that it doesn’t trigger anymore. Returns the previously set timer delays.
Declaration
Swift
public func unset() throws -> (initial: TimeInterval, interval: TimeInterval)
-
Returns the currently set timer delays.
Declaration
Swift
public func get() throws -> (initial: TimeInterval, interval: TimeInterval)
-
Returns the number of times the timer expired since the last call.
Declaration
Swift
public func expirations() throws -> UInt64
-
Releases the resources for this file descriptor.
Declaration
Swift
public func close() throws
-
The flags to configure the timer file descriptor.
See moreDeclaration
Swift
public struct Flags: OptionSet