Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/time-resolutions
A collection of time resolutions in milliseconds
https://github.com/binocarlos/time-resolutions
Last synced: 10 days ago
JSON representation
A collection of time resolutions in milliseconds
- Host: GitHub
- URL: https://github.com/binocarlos/time-resolutions
- Owner: binocarlos
- License: mit
- Created: 2014-04-08T02:31:05.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-09T12:37:45.000Z (over 10 years ago)
- Last Synced: 2024-04-14T14:36:48.515Z (7 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
time-resolutions
================![Build status](https://api.travis-ci.org/binocarlos/time-resolutions.svg)
A collection of time resolutions in milliseconds
## installation
```
$ npm install time-resolutions
```## usage
```js
var resolutions = require('time-resolutions');// 150 milliseconds
var ms = 150;var m = resolutions.resolve(ms); // millisecond
// 3.5 seconds
var secs = 3500;var s = resolutions.resolve(secs); // second
// 2.5 weeks
var weeks = 2.5 * 1000 * 60 * 60 * 24 * 7;var w = resolutions.resolve(weeks); // week
// how many milliseconds are in 3 weeks?
var ms = 3 * resolutions.week;
```### var resolutions.resolve(ms)
Return a string that represents the resolution of the millisecond gap you provide.
### var ms = resolutions.ms('week')
Get how many milliseconds there are in a:
* second
* minute
* hour
* day
* week
* month
* year```js
var resolutions = require('time-resolutions');var ms_in_a_week = resolutions.ms('week');
```## license
MIT