-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Date.description in pure Swift
# Motivation The current implementation of `Date.description` is depending on the what platform we are running on. On Darwin it used the CFFoundation backed implementation and on Linux/Windows it used libc APIs to do the date calculations. This caused build issues on Windows and the libc APIs are not 32bit clean. # Changes This PR changes the implementation by using the methods implemented in swift-certificates that provide timestamp to UTC time calculations. These were added in swift-certificates for the exact same reason. Furthermore, it removes the conditional usage of CFFoundation since the output is the same. # Result Swift only implementation that works cross platform for `Date.description` which also should perform better than any libc API calls. Align the tests Code review Code review Fix compiler error
- Loading branch information
1 parent
3d52b25
commit 05da61e
Showing
4 changed files
with
353 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
The SwiftFoundation Project | ||
===================== | ||
|
||
Please visit the SwiftFoundation web site for more information: | ||
|
||
* https://github.com/apple/swift-foundation | ||
|
||
Copyright 2023 The SwiftFoundation Project | ||
|
||
The SwiftFoundation Project licenses this file to you under the Apache License, | ||
version 2.0 (the "License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at: | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations | ||
under the License. | ||
|
||
Also, please refer to each LICENSE.txt file, which is located in | ||
the 'license' directory of the distribution file, for the license terms of the | ||
components that this product depends on. | ||
|
||
--- | ||
|
||
This product contains derivations of the time calculations from SwiftCertificates. | ||
|
||
* LICENSE (Apache License 2.0): | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* HOMEPAGE: | ||
* https://github.com/apple/swift-certificates | ||
|
||
--- | ||
|
||
This product contains code to calculate and decompose UNIX timestamps derived from musl libc. | ||
|
||
* LICENSE (MIT): | ||
* https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT | ||
* HOMEPAGE: | ||
* https://musl.libc.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.