# set-clock-interval

> Uses a clock to set intervals

Latest version **1.0.1** (published 2019-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install set-clock-interval
pnpm add set-clock-interval
yarn add set-clock-interval
bun add set-clock-interval
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-12-29 |
| First published | 2019-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lambdah |
| Maintainers | lambdah |

## Links

- npm: https://www.npmjs.com/package/set-clock-interval
- Repository: https://github.com/Lambdah/set-clock-interval
- Homepage: https://github.com/Lambdah/set-clock-interval#readme
- Issues: https://github.com/Lambdah/set-clock-interval/issues
- npm.io page: https://npm.io/package/set-clock-interval

## Recent versions

- 1.0.1 (latest) — 2019-12-29
- 1.0.0 — 2019-12-29

## README

# Set Clock Interval
Set an interval based on the local time for callbacks
##### Usage
```
const setClockInterval = require('set-clock-interval')
setClockInterval('HH:MM:SS', callback, params1,params2,..)
```
The time has to be a string with hours:minutes:seconds in 24 hour clock that you want
the callback to occur. Time of callback is based on your current
server's clock.
 
The callback is the function that is to be called, and params are the callback's
parameters.

##### Example
```javascript
const setClockInterval = require('set-clock-interval')

function add(one, two, three){
    return one + two + three
}

setClockInterval('03:00:00', add, 1, 2, 3)
```
At 3 am system clock, the function 'add' will be called with
the parameters 1, 2, and 3. The function 'add' will keep being
called at 3 am until the program is cancelled.

```javascript
const setClockInterval = require('set-clock-interval')

function sayHello(){
    console.log("Hello World!")
}

var hello = setClockInterval('20:30:00', sayHello)
clearInterval(hello)
```
At 8:30 pm system clock, the function 'sayHello' will be called once.
The clearInterval stop the execution of the interval from being called every 24 hours,
but does not clear the first execution.

## License
[MIT](https://choosealicense.com/licenses/mit/)

---
_Source: https://npm.io/package/set-clock-interval · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
