fast-date

3.0.3 • Public • Published

fast-date

Build Status codecov

High Speed UTC Timestamps

Supports

  • Node 6
  • Node 8
  • Node 10

Benchmarks

npm run bench
NativeDate*100000: 175.776ms
FastDateUnix*100000: 98.684ms
FastDateUtc*100000: 96.166ms
DateNow*100000: 107.326ms
TimerNow*100000: 105.762ms

fast-date is about as fast at providing UTC timestamps as Date.now is at providing millisecond epochs.

Usage

var fastDate = require('fast-date')()
var http = require('http')
 
http.createServer(function (req, res) {
  res.end(fastDate())
}).listen(8080)

Options

format

Set the output, current options:

  • utc output a UTC timestamp
  • unix output seconds since the unix Epoch
var fastDate = require('fast-date')({format: 'unix'})

prefix & suffix

Add strings before and after:

var fastDate = require('fast-date')({prefix: 'some text before', suffix: 'some text after'})

Tests

npm test

Coverage

npm run cov 
----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
 index.js |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

More Benchmarks

For effects on an HTTP server:

npm run bench-http

License

MIT

Acknowledgements

Sponsored by nearForm

Package Sidebar

Install

npm i fast-date

Weekly Downloads

2

Version

3.0.3

License

MIT

Unpacked Size

10.6 kB

Total Files

10

Last publish

Collaborators

  • davidmarkclements