File tree 2 files changed +5
-6
lines changed
Sources/DistributedCluster
Tests/DistributedClusterTests
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,14 @@ extension TimeSpec {
45
45
@usableFromInline
46
46
internal static func + ( a: timespec , b: timespec ) -> timespec {
47
47
let totalNanos = a. toNanos ( ) + b. toNanos ( )
48
- let seconds = totalNanos / NANOS
49
48
var result = timespec ( )
50
- result. tv_sec = seconds
51
- result. tv_nsec = totalNanos % NANOS
49
+ result. tv_sec = Int ( totalNanos / Int64 ( NANOS ) )
50
+ result. tv_nsec = Int ( totalNanos % Int64 ( NANOS) )
52
51
return result
53
52
}
54
53
55
54
@usableFromInline
56
- internal func toNanos( ) -> Int {
57
- self . tv_nsec + ( self . tv_sec * NANOS)
55
+ internal func toNanos( ) -> Int64 {
56
+ Int64 ( self . tv_nsec) + ( Int64 ( self . tv_sec) * Int64 ( NANOS) )
58
57
}
59
58
}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class TimeSpecTests: XCTestCase {
38
38
}
39
39
40
40
func test_timeSpecShouldBeCreatedProperlyFromDuration( ) {
41
- self . total. toNanos ( ) . shouldEqual ( Int ( self . totalDuration. nanoseconds) )
41
+ self . total. toNanos ( ) . shouldEqual ( Int64 ( self . totalDuration. nanoseconds) )
42
42
self . total. tv_sec. shouldEqual ( Int ( self . totalDuration. nanoseconds) / NANOS)
43
43
self . total. tv_nsec. shouldEqual ( Int ( self . totalDuration. nanoseconds) % NANOS)
44
44
}
You can’t perform that action at this time.
0 commit comments