ffd3d7a4d1 | ||
---|---|---|
.github/workflows | ||
Sources/TimeSpecification | ||
Tests | ||
.gitignore | ||
LICENSE.txt | ||
Package.swift | ||
README.md |
README.md
What is SwiftTimeSpecification?
SwiftTimeSpecification is an implementation of struct timespec
(struct mach_timespec
on OS X) in Swift.
Its prototype is YOCKOW's Gist.
Sample Code
import TimeSpecification
func time(_ body:() -> Void) {
let start = TimeSpecification(clock: .system)
body()
let end = TimeSpecification(clock: .system)
let duration = end - start
print("\(duration)")
}
Requirements
- Swift 5 (including compatibility mode for 4, 4.2)
- macOS or Linux
License
MIT License.
See "LICENSE.txt" for more information.