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
- Host: GitHub
- URL: https://github.com/filinvadim/wall-clock-ticker
- Owner: filinvadim
- License: bsd-2-clause
- Created: 2023-06-17T14:20:54.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-06T12:23:28.000Z (over 1 year ago)
- Last Synced: 2025-07-04T16:53:19.576Z (11 months ago)
- Topics: golang, golang-library, wall, wall-clock, wall-clock-ticker, wallclock
- Language: Go
- Homepage: https://en.wikipedia.org/wiki/Elapsed_real_time
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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).