-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: NIO.TimeAmount(string:) and TimeAmount.description (#3046)
Adds `TimeAmount.init(string:)` and `TimeAmount.description` for parsing time amounts from strings and pretty printing them. Closes #2504. ### Motivation: Had a minute, wanted to work on Swift-NIO a bit more, and saw @weissi still wanted this. ### Modifications: It's largely based on the snippet @weissi made in #2504 with a few changes: - Added unit tests. - Added support for more unit aliases for convenience based on @glbrntt's suggestion. - Changed `.gitignore` to ignore `.build` everywhere, I've got a few of them when testing locally. ### Open questions: - I originally thought perhaps I should add support for multiple number and unit pairs, i.e. `1h 31m`, but decided against it. Feels like an edge case. Happy to add this if you think it's needed. --------- Co-authored-by: Cory Benfield <[email protected]>
- Loading branch information
1 parent
30e1f2e
commit f5773c1
Showing
3 changed files
with
185 additions
and
2 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.DS_Store | ||
/.build | ||
.build | ||
/.index-build | ||
/Packages | ||
/*.xcodeproj | ||
|
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
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