mirror of
https://github.com/apple/swift-nio
synced 2026-11-22 04:30:41 +00:00
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 <lukasa@apple.com>
16 lines
168 B
Plaintext
16 lines
168 B
Plaintext
.DS_Store
|
|
.build
|
|
/.index-build
|
|
/Packages
|
|
/*.xcodeproj
|
|
Package.pins
|
|
*.pem
|
|
/docs/1.*
|
|
/docs/2.*
|
|
Package.resolved
|
|
.podspecs
|
|
DerivedData
|
|
.swiftpm
|
|
.*.sw?
|
|
.vscode/launch.json
|