Created
July 17, 2022 12:33
-
-
Save wplong11/04cb620f44a616289f0068cdb6047f08 to your computer and use it in GitHub Desktop.
DispatchTimeIntervalExtension.swift
This file contains hidden or 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
| import Foundation | |
| extension DispatchTimeInterval { | |
| func asTimeInterval() -> TimeInterval { | |
| switch self { | |
| case let .nanoseconds(value): return Double(value) / 1_000_000_000 | |
| case let .microseconds(value): return Double(value) / 1_000_000 | |
| case let .milliseconds(value): return Double(value) / 1_000 | |
| case let .seconds(value): return Double(value) | |
| case .never: return Double.infinity | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment