Skip to content

Add support for .withFractionalSeconds to ISO8601DateFormatter. #1586

New issue

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

Merged
merged 1 commit into from
Jun 11, 2018

Conversation

armadsen
Copy link
Contributor

@armadsen armadsen commented Jun 8, 2018

This fixes SR-7079.

@pushkarnk
Copy link
Member

@swift-ci please test

@millenomi
Copy link
Contributor

On behalf of @parkera, approved.

@millenomi millenomi self-requested a review June 8, 2018 22:49
@millenomi
Copy link
Contributor

Per @spevans: this patch may fail on Ubuntu 14.04 because of libicu version mismatches. (cc @parkera.)

I'm going to veto it for now, but it's only until we can figure out how to version things so that we can pipe through the ICU version and make it conditionally available.

@armadsen
Copy link
Contributor Author

armadsen commented Jun 8, 2018

Thanks everyone. I'd be happy to work on the underlying issue of making it conditional on a new-enough underlying ICU version.

@parkera
Copy link
Contributor

parkera commented Jun 9, 2018

Is there a macro defined by ICU that we could use to conditionally compile this in?

@millenomi
Copy link
Contributor

Yes, but we have to pipe it through to the Swift build somehow.

@spevans
Copy link
Contributor

spevans commented Jun 9, 2018

ICU defines U_ICU_VERSION_MAJOR_NUM (52 on 14.04, 55 on 16.04) so this could be used to set a #define in ForSwiftFoundationOnly.h. I suggested something similar in #1522 (comment)

@millenomi
Copy link
Contributor

millenomi commented Jun 9, 2018

@millenomi
Copy link
Contributor

My next step is to run DarwinCompat and see if the new tests pass on Darwin as well. If they do, it means 16.04 supports at least as much as Darwin.

@millenomi
Copy link
Contributor

(or is a strong signal to that effect.)

@millenomi
Copy link
Contributor

If someone could run tests here and check they pass on 14.04, it'd eliminate ambiguity. But I don't have a 14.04 box handy.

@millenomi
Copy link
Contributor

To be clear: it looks like 14.04 (ICU 52.1) has support for the S modifier in dtfmtsym.cpp much like later versions. It's only behavior differences that concern me.

@spevans
Copy link
Contributor

spevans commented Jun 9, 2018

For completeness, Ubuntu 18.04 ships with 60.2

@millenomi
Copy link
Contributor

I decided to just set up a 14.04 VM, see if tests run there, and if so just introduce the API.

@millenomi
Copy link
Contributor

millenomi commented Jun 11, 2018

Tests pass locally on 14.04.


millenomi@ubuntu1404:/media/millenomi/Sources/swift-corelibs-foundation$ LD_LIBRARY_PATH=/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/foundation-linux-x86_64/Foundation/:/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/xctest-linux-x86_64:/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/libdispatch-linux-x86_64/src/.libs: ../build/Ninja-RelWithDebInfoAssert/foundation-linux-x86_64/TestFoundation/TestFoundation
Test Suite 'All tests' started at 2018-06-11 01:41:45.261
…
Test Suite 'All tests' passed at 2018-06-11 01:42:11.334
	 Executed 1330 tests, with 0 failures (0 unexpected) in 25.85 (25.85) seconds

millenomi@ubuntu1404:/media/millenomi/Sources/swift-corelibs-foundation$ LD_LIBRARY_PATH=/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/foundation-linux-x86_64/Foundation/:/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/xctest-linux-x86_64:/media/millenomi/Sources/build/Ninja-RelWithDebInfoAssert/libdispatch-linux-x86_64/src/.libs: ../build/Ninja-RelWithDebInfoAssert/foundation-linux-x86_64/TestFoundation/TestFoundation TestFoundation.TestISO8601DateFormatter
Test Suite 'Selected tests' started at 2018-06-11 01:42:48.748
Test Suite 'TestISO8601DateFormatter' started at 2018-06-11 01:42:48.752
Test Case 'TestISO8601DateFormatter.test_stringFromDate' started at 2018-06-11 01:42:48.752
Test Case 'TestISO8601DateFormatter.test_stringFromDate' passed (0.022 seconds)
Test Case 'TestISO8601DateFormatter.test_dateFromString' started at 2018-06-11 01:42:48.774
Test Case 'TestISO8601DateFormatter.test_dateFromString' passed (0.001 seconds)
Test Case 'TestISO8601DateFormatter.test_stringFromDateClass' started at 2018-06-11 01:42:48.775
Test Case 'TestISO8601DateFormatter.test_stringFromDateClass' passed (0.015 seconds)
Test Suite 'TestISO8601DateFormatter' passed at 2018-06-11 01:42:48.791
	 Executed 3 tests, with 0 failures (0 unexpected) in 0.038 (0.038) seconds
Test Suite 'Selected tests' passed at 2018-06-11 01:42:48.791
	 Executed 3 tests, with 0 failures (0 unexpected) in 0.038 (0.038) seconds

millenomi@ubuntu1404:/media/millenomi/Sources/swift-corelibs-foundation$ uname -a
Linux ubuntu1404 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

@millenomi millenomi merged commit 0da7da2 into swiftlang:master Jun 11, 2018
@armadsen
Copy link
Contributor Author

Thanks for your work on this @millenomi, and thanks for the help getting it put together, @pushkarnk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants