-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Hi there
I really like this library, so I thought I'd mention some weird behaviour I encountered while unit testing.
I set my clock rate at x100 to speed everything up during tests, but noticed some inaccuracies while doing this. Maybe this is just an example of #42 ?
var cancels: [AnyCancellable] = []
let fixedStart = Clocks.system.nextHour().firstInstant
let fastClock = Clocks.custom(startingFrom: fixedStart, rate: 100)
fastClock
.chime(at: fastClock.thisSecond() + .seconds(10))
.sink { _ in
print("chimed at \(fastClock.now().date)")
}
.store(in: &cancels)
fastClock
.chime(at: fastClock.thisSecond() + .seconds(17))
.sink { _ in
print("chimed at \(fastClock.now().date)")
}
.store(in: &cancels)
// chimed at 2023-08-21 12:00:10 +0000
// chimed at 2023-08-21 12:00:47 +0000
The first chime works as expected, but for any value above 17 'seconds' the timing is off.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels