File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 14
14
15
15
#if os(Linux) || os(FreeBSD)
16
16
import Glibc
17
+ import Foundation
17
18
#else
18
19
import Darwin
20
+ import SwiftFoundation
19
21
#endif
20
22
21
23
internal func XCTPrint( message: String ) {
@@ -36,7 +38,7 @@ struct XCTFailure {
36
38
}
37
39
38
40
internal struct XCTRun {
39
- var duration : TimeInterval
41
+ var duration : NSTimeInterval
40
42
var method : String
41
43
var passed : Bool
42
44
var failures : [ XCTFailure ]
Original file line number Diff line number Diff line change 13
13
14
14
#if os(Linux) || os(FreeBSD)
15
15
import Glibc
16
+ import Foundation
16
17
#else
17
18
import Darwin
19
+ import SwiftFoundation
18
20
#endif
19
21
20
- internal typealias TimeInterval = Double
21
-
22
22
/// Returns the number of seconds since the reference time as a Double.
23
- private func currentTimeIntervalSinceReferenceTime( ) -> TimeInterval {
23
+ private func currentTimeIntervalSinceReferenceTime( ) -> NSTimeInterval {
24
24
var tv = timeval ( )
25
- let currentTime = withUnsafeMutablePointer ( & tv, { ( t: UnsafeMutablePointer < timeval > ) -> TimeInterval in
25
+ let currentTime = withUnsafeMutablePointer ( & tv, { ( t: UnsafeMutablePointer < timeval > ) -> NSTimeInterval in
26
26
gettimeofday ( t, nil )
27
- return TimeInterval ( t. pointee. tv_sec) + TimeInterval ( t. pointee. tv_usec) / 1000000.0
27
+ return NSTimeInterval ( t. pointee. tv_sec) + NSTimeInterval ( t. pointee. tv_usec) / 1000000.0
28
28
} )
29
29
return currentTime
30
30
}
31
31
32
32
/// Execute the given block and return the time spent during execution
33
- internal func measureTimeExecutingBlock( @noescape block: ( ) -> Void ) -> TimeInterval {
33
+ internal func measureTimeExecutingBlock( @noescape block: ( ) -> Void ) -> NSTimeInterval {
34
34
let start = currentTimeIntervalSinceReferenceTime ( )
35
35
block ( )
36
36
let end = currentTimeIntervalSinceReferenceTime ( )
@@ -39,6 +39,6 @@ internal func measureTimeExecutingBlock(@noescape block: () -> Void) -> TimeInte
39
39
}
40
40
41
41
/// Returns a string version of the given time interval rounded to no more than 3 decimal places.
42
- internal func printableStringForTimeInterval( timeInterval: TimeInterval ) -> String {
42
+ internal func printableStringForTimeInterval( timeInterval: NSTimeInterval ) -> String {
43
43
return String ( round ( timeInterval * 1000.0 ) / 1000.0 )
44
44
}
You can’t perform that action at this time.
0 commit comments