We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 158284e commit bd6fdc7Copy full SHA for bd6fdc7
Shared/CommandParser.swift
@@ -291,8 +291,8 @@ public class TimeParser {
291
/// Truncates the time to the specified number of decimal places
292
public class func truncateTime(_ time: TimeInterval, places: Int = 5) -> TimeInterval {
293
let multiplier = (pow(10, places) as NSNumber).doubleValue
294
-
295
- return (Double(Int(time * multiplier)) / multiplier)
+ let fraction = (Double(Int(time.truncatingRemainder(dividingBy: 1) * multiplier)) / multiplier)
+ return Double(Int(time)) + fraction
296
}
297
298
/// Get duration in seconds from a string with the format HH:mm:ss or mm:ss
0 commit comments