Skip to content

Commit bc92ce7

Browse files
authored
Merge pull request #84 from PiotrTHOC/download-percentage-fix
fix download percentage not always getting to 1 due to rounding errors
2 parents a5d27e9 + 4294b52 commit bc92ce7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/RealHTTP/Client/Internal/Other Structures/HTTPProgress.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public struct HTTPProgress: Comparable, Equatable {
8484
self.partialData = partialData
8585

8686
if expectedLength != NSURLSessionTransferSizeUnknown, expectedLength != 0 {
87-
let slice = Double(1.0)/Double(expectedLength)
88-
self.percentage = slice*Double(currentLength)
87+
self.percentage = Double(currentLength)/Double(expectedLength)
8988
} else {
9089
self.percentage = 0
9190
}

0 commit comments

Comments
 (0)