GitXplorerGitXplorer
Y

SwiftTimeSpecification

public
3 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
5a968a5367c7a8556918534d9b7b3c8414eb8d01

Merge pull request #9 from YOCKOW/development

YYOCKOW committed 3 months ago
Verified
edaba0777d5f073345774ae777a2ba9cebb4939e

Merge remote-tracking branch 'GitHub/development' into development

YYOCKOW committed 3 months ago
Verified
3d475efb11fa524c02a1c7662ac0a61fad1e5417

Support Swift 6.

YYOCKOW committed 3 months ago
Verified
8e4de4e0fb46fd91cd0bfea102756cf86a86e708

Merge pull request #7 from YOCKOW/development

YYOCKOW committed 4 years ago
Verified
da2ee929a360d2abd490644fde7b28d57108e1be

Merge pull request #8 from YOCKOW/linux

YYOCKOW committed 4 years ago
Unverified
b9c3ac50280cc4ec670057a12967bc661952b4bf

Remove LinuxMain.swift and XCTestManifests.swift

YYOCKOW committed 4 years ago

README

The README file for this repository.

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, 6 (including language mode for 4, 4.2)
  • macOS or Linux

License

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