-
Notifications
You must be signed in to change notification settings - Fork 119
Description
When converting an Instant
to NSDate
and back to Instant
the value is rounded to milliseconds. However, when testing I see microsecond precision after calling toNSDate()
and even when using NSDate.addTimeInterval()
and also when instantiating a new NSDate()
object. This doesn’t match what the docstring claims.
You probably only refer to the NSDateFormatter having a bug and dropping to millisecond precision? The rest of the NSDate API seems to work fine with microsecond precision though, so it makes no sense to be lossy in Kotlin.
At the Kotlin level, the loss in precision only happens in the NSDate.toKotlinInstant()
extension function. Could you please fix this function to preserve microsecond precision instead of millisecond precision - consistent with the test result?
Also, the toNSDate()
function doesn't round the last (microsecond) digit, which is probably a bug.