Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
randymarsh77 committed Nov 29, 2016
1 parent 4c8c425 commit 0325c5d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,43 @@ A small utility to handle mach_absolute_time and timestamps.
[![GitHub release](https://img.shields.io/github/release/randymarsh77/time.svg)]()
[![SPM](https://img.shields.io/badge/SPM-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
[![Build Status](https://api.travis-ci.org/randymarsh77/time.svg?branch=master)](https://travis-ci.org/randymarsh77/time)
[![codecov.io](https://codecov.io/gh/randymarsh77/time/branch/master/graphs/badge.svg)](https://codecov.io/gh/randymarsh77/time/branch/master)
[![codebeat badge](https://codebeat.co/badges/bbf19ae9-35d5-4eb5-a47f-561480300607)](https://codebeat.co/projects/github-com-randymarsh77-time)

# Usage

Create some time
```
let now = Time.Now
```

Get the mach value
```
let mach = now.machTimeStamp
```

Create some time with a mach value
```
_ = time.FromMachTimeStamp(mach)
```

Add a second
```
let aSecondFromNow = now + Time(value: 1, unit: .Seconds)
```

Subtract some micros
```
_ = aSecondFromNow - Time(value: 1234, unit: .Microseconds)
```

Compare
```
_ = aSecondFromNow == now
_ = aSecondFromNo != now
```

Make a second
```
aSecond = aSecondFromNow - now
```

0 comments on commit 0325c5d

Please sign in to comment.