File tree Expand file tree Collapse file tree 2 files changed +5
-22
lines changed Expand file tree Collapse file tree 2 files changed +5
-22
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2020 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2020-2022 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See http://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@ import Dispatch
12
12
import struct Foundation. TimeInterval
13
13
14
14
extension DispatchTimeInterval {
15
- func timeInterval( ) -> TimeInterval ? {
15
+ public func timeInterval( ) -> TimeInterval ? {
16
16
switch self {
17
17
case . seconds( let value) :
18
18
return Double ( value)
@@ -27,7 +27,7 @@ extension DispatchTimeInterval {
27
27
}
28
28
}
29
29
30
- func milliseconds( ) -> Int ? {
30
+ public func milliseconds( ) -> Int ? {
31
31
switch self {
32
32
case . seconds( let value) :
33
33
return value. multipliedReportingOverflow ( by: 1000 ) . partialValue
@@ -42,7 +42,7 @@ extension DispatchTimeInterval {
42
42
}
43
43
}
44
44
45
- func seconds( ) -> Int ? {
45
+ public func seconds( ) -> Int ? {
46
46
switch self {
47
47
case . seconds( let value) :
48
48
return value
Original file line number Diff line number Diff line change @@ -1198,7 +1198,7 @@ extension SwiftTestTool {
1198
1198
// Run the test — for now we run the sequentially so we can capture accurate timing results.
1199
1199
let startTime = DispatchTime . now ( )
1200
1200
let ( success, _) = testRunner. test ( writeToOutputStream: false )
1201
- let duration = startTime. distance ( to: . now( ) ) . asSeconds ?? 0.0
1201
+ let duration = Double ( startTime. distance ( to: . now( ) ) . milliseconds ( ) ?? 0 ) / 1000 .0
1202
1202
numFailedTests += success ? 0 : 1
1203
1203
testResults. append ( . init( name: testName, result: success ? . succeeded : . failed, duration: duration) )
1204
1204
}
@@ -1261,20 +1261,3 @@ extension SwiftTestTool {
1261
1261
codeCoverageDataFile: codeCoverageDataFile? . pathString)
1262
1262
}
1263
1263
}
1264
-
1265
- fileprivate extension DispatchTimeInterval {
1266
- var asSeconds : Double ? {
1267
- switch self {
1268
- case . seconds( let value) :
1269
- return Double ( value)
1270
- case . milliseconds( let value) :
1271
- return Double ( value) / 1000
1272
- case . microseconds( let value) :
1273
- return Double ( value) / 1_000_000
1274
- case . nanoseconds( let value) :
1275
- return Double ( value) / 1_000_000_000
1276
- default :
1277
- return . none
1278
- }
1279
- }
1280
- }
You can’t perform that action at this time.
0 commit comments