diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d80cca72..7bb17300 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -3,6 +3,7 @@ Contributors Contributors to the codebase, in reverse chronological order: +- Marco Festini, @Legi429 - Dave Carlson, @drdavec - Pascal Pfiffner, @p2 diff --git a/Sources/Models/DateAndTime.swift b/Sources/Models/DateAndTime.swift index 4e757183..97f5c0bd 100644 --- a/Sources/Models/DateAndTime.swift +++ b/Sources/Models/DateAndTime.swift @@ -780,8 +780,9 @@ class DateNSDateConverter { comp.minute = Int(min) } if let sec = time?.second { - comp.second = Int(floor(sec)) - comp.nanosecond = Int(sec.truncatingRemainder(dividingBy: 1000000000)) + let floorSec = floor(sec) + comp.second = Int(floorSec) + comp.nanosecond = Int((sec - floorSec) * 1000000000) } return calendar.date(from: comp) ?? Date()