An open API service indexing awesome lists of open source software.

https://github.com/filinvadim/wall-clock-ticker

Ticker that ticks according to wall clock
https://github.com/filinvadim/wall-clock-ticker

golang golang-library wall wall-clock wall-clock-ticker wallclock

Last synced: 4 months ago
JSON representation

Ticker that ticks according to wall clock

Awesome Lists containing this project

README

          


golang-action status

# wall-clock-ticker

Golang wall clock ticker is a [Go](http://golang.org/) library that provides a ticker which ticks according to wall clock.

Installation
------------
```sh
go get -u github.com/filinvadim/wall-clock-ticker
```

Usage
--------

Using Golang wall clock ticker is very much like time.NewTicker with the addition of an accuracy and start time.

The following creates a ticker which ticks on the minute according the hosts wall clock with an accuracy of plus or minus one second.
```go
package main

import (
"fmt"
"time"

wct "github.com/filinvadim/wall-clock-ticker"
)

func main() {
// ticks every 59th minute of every hour
t := wct.NewWCTicker(time.Minute*59, time.Second)
for tick := range t.C {
// Process tick
fmt.Println("tick:", tick)
}
}
```

License
-------
Golang wall clock ticker is available under the [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).