3.0.3 • Published 7 years ago
fast-date v3.0.3
fast-date
High Speed UTC Timestamps
Supports
- Node 6
- Node 8
- Node 10
Benchmarks
npm run benchNativeDate*100000: 175.776ms
FastDateUnix*100000: 98.684ms
FastDateUtc*100000: 96.166ms
DateNow*100000: 107.326ms
TimerNow*100000: 105.762msfast-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:
utcoutput a UTC timestampunixoutput 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 testCoverage
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-httpLicense
MIT
Acknowledgements
Sponsored by nearForm