Skip to content

Commit b785b2c

Browse files
committed
refactor: derive uncapped recorder timescale from interval
1 parent c6a0d24 commit b785b2c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ final class RunnerTests: XCTestCase {
7777
private let outputPath: String
7878
private let fps: Int32?
7979
private let uncappedFrameInterval: TimeInterval = 0.001
80-
private let timestampTimescaleUncapped: Int32 = 600
80+
private var uncappedTimestampTimescale: Int32 {
81+
Int32(max(1, Int((1.0 / uncappedFrameInterval).rounded())))
82+
}
8183
private var frameInterval: TimeInterval {
8284
guard let fps else { return uncappedFrameInterval }
8385
return 1.0 / Double(fps)
@@ -273,7 +275,7 @@ final class RunnerTests: XCTestCase {
273275
recordingStartUptime = nowUptime
274276
}
275277
let elapsed = max(0, nowUptime - (recordingStartUptime ?? nowUptime))
276-
let timescale = fps ?? timestampTimescaleUncapped
278+
let timescale = fps ?? uncappedTimestampTimescale
277279
var timestampValue = Int64((elapsed * Double(timescale)).rounded(.down))
278280
if timestampValue <= lastTimestampValue {
279281
timestampValue = lastTimestampValue + 1

0 commit comments

Comments
 (0)