RSDClock

public class RSDClock

The purpose of this struct is to allow using a normalized uptime for processes that may need to track the time while the device is asleep. This clock stopwatch will keep running even when the device has gone to sleep.

  • The absolute start uptime for when this clock was instantiated. This uses the clock time rather than the system uptime that is used for tasks that will only fire when the device is awake.

    Declaration

    Swift

    public var startUptime: TimeInterval { get }
  • The system uptime for when the clock was instantiated.

    Declaration

    Swift

    public var startSystemUptime: TimeInterval { get }
  • The date timestamp for when the clock was instantiated.

    Declaration

    Swift

    public let startDate: Date
  • Is the clock paused?

    Declaration

    Swift

    public var isPaused: Bool { get }
  • The time interval for how long the step has been running.

    Declaration

    Swift

    public func runningDuration() -> TimeInterval
  • Pause the clock.

    Declaration

    Swift

    public func pause()
  • resume the clock.

    Declaration

    Swift

    public func resume()
  • Get the clock uptime for a system awake time.

    Declaration

    Swift

    public func relativeUptime(to systemUptime: TimeInterval) -> TimeInterval
  • Get the clock uptime for a system awake time.

    Declaration

    Swift

    public func zeroRelativeTime(to systemUptime: TimeInterval) -> TimeInterval
  • Clock time.

    Declaration

    Swift

    public static func uptime() -> TimeInterval