New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/stvp/clock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/stvp/clock

  • v0.0.0-20150131035142-7c6c06e061f0
  • Source
  • Go
  • Socket score

Version published
Created
Source

clock

A clock takes any number of strings and sends them at a somewhat consistent rate on a channel. You can specify a tick interval and a cycle duration to control how long it takes for the full set of keys to be cycled through. For example, if you use an interval of 1 second and a cycle time of 1 minute and add 120 keys, the clock will send a string on Channel 120 times per minute (2 per second on average).

Any given key will always be placed at the same position on the clock as long as the interval and cycle remain the same.

The clock can be stopped and started at any time.

package main

import (
	"fmt"
	"github.com/stvp/clock"
	"time"
)

func main() {
	c, err := clock.New(100*time.Millisecond, time.Minute, 0)
	if err != nil {
		panic(err)
	}
	c.Add("neat")
	c.Add("dude")
	c.Add("rad")
	c.Start()

	for str := range c.Channel {
		fmt.Printf("Received: %s\n", str)
	}
}

FAQs

Package last updated on 31 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc