Package Exports
- fast-date
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-date) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fast-date
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 timestampunix
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