We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
md5: 6233259148dc92d048f460a092c115ad
Issue Description:
I am trying to get the elapsed nanosecods via the Calendar API like this
let elapsedNano = Calendar.current.dateComponents([.nanosecond], from: self.startTime, to: now).nanosecond
This fails on Ubuntu 18.04 with the following error
Fatal error: : file Foundation/NSCalendar.swift, line 617
Using .second in the given call seems to work. The same code on MacOS works fine.
The text was updated successfully, but these errors were encountered:
This was fixed in swift-5.0 to return the correct nanosecond component
$ cat sr-9439.swift import Foundation let now = Date() let then = Date(timeIntervalSince1970: now.timeIntervalSince1970 - 1.2345678) let elapsedNano = Calendar.current.dateComponents([.nanosecond], from: then, to: now).nanosecond print(elapsedNano ?? "nil") $ ~/swift-5.0.3-RELEASE-ubuntu14.04/usr/bin/swift sr-9439.swift 1234567871
Sorry, something went wrong.
No branches or pull requests
Additional Detail from JIRA
md5: 6233259148dc92d048f460a092c115ad
Issue Description:
I am trying to get the elapsed nanosecods via the Calendar API like this
This fails on Ubuntu 18.04 with the following error
Fatal error: : file Foundation/NSCalendar.swift, line 617
Using .second in the given call seems to work. The same code on MacOS works fine.
The text was updated successfully, but these errors were encountered: