mirror of
https://github.com/aculix/knotchy.git
synced 2026-10-27 07:15:53 +00:00
Initial release
This commit is contained in:
commit
4b67728cce
108 files changed
+13310
No files matched your search
@@ -0,0 +1,15 @@
|
||||
/// `ContinuousClock` keeps counting while the Mac sleeps, so an expired idle countdown fires on wake.
|
||||
public protocol KnotchyClock: Sendable {
|
||||
var now: ContinuousClock.Instant { get }
|
||||
func sleep(until deadline: ContinuousClock.Instant) async throws
|
||||
}
|
||||
|
||||
public struct SystemClock: KnotchyClock {
|
||||
public init() {}
|
||||
|
||||
public var now: ContinuousClock.Instant { .now }
|
||||
|
||||
public func sleep(until deadline: ContinuousClock.Instant) async throws {
|
||||
try await Task.sleep(until: deadline, clock: .continuous)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user