Swiftpack.co -  YOCKOW/SwiftTimeSpecification as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
YOCKOW/SwiftTimeSpecification
Get `timespec` in Swift.
.package(url: "https://github.com/YOCKOW/SwiftTimeSpecification.git", from: "3.3.0")

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

Measure

import TimeSpecification

let duration = TimeSpecification.measure(repeatCount: 100) { doIt() }
print("It took \(duration) seconds.") // -> Processing time to execute `doIt` 100 times. 

With Date

import TimeSpecification

let now = TimeSpecification(clock: .calendar)
let dateNow = Date(timeIntervalSince1970: now) // -> Almost same with Date(timeIntervalSince1970: Double(time(nil)))

Requirements

  • Swift 5 (including compatibility mode for 4, 4.2)
  • macOS or Linux

License

MIT License.
See "LICENSE.txt" for more information.

GitHub

link
Stars: 2
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API