No description, website, or topics provided.
JavaScript
Latest commit 5421adb Aug 19, 2014 @dominictarr 0.0.9
Permalink
Failed to load latest commit information.
test more reporting in test Oct 31, 2012
.gitignore initial Oct 22, 2012
.travis.yml initial Oct 22, 2012
LICENSE initial Oct 22, 2012
README.md Link to monotonic-timestamp-base36 Aug 19, 2014
index.js fix so is uglifyable Feb 4, 2013
package.json 0.0.9 Aug 19, 2014

README.md

monotonic-timestamp

Monotonically increasing timestamp.

<img src=https://secure.travis-ci.org/'Dominic Tarr'/monotonic-timestamp.png?branch=master>

This is NOT a accurate representation of the time. Since js only measures time as ms, if you call Date.now() twice quickly, it's possible to get two identical time stamps.

monotonic-timestamp fixes that problem! (crudely)

Example

var timestamp = require('monotonic-timestamp')

console.log(timestamp())
console.log(timestamp())
console.log(timestamp())
console.log(timestamp())
console.log(timestamp())

subsequent calls to timestamp() are ALWAYS strictly ordered.

byte optimizations

My precious bytes! wasted on your timestamp!

pack it into a string!

timestamp().toString(36) 

if you want a constant-length string, you can use monotonic-timestamp-base36

of course, if you are using a binary protocol, it will be cheaper to use the float...

##TODO

syncronize network time.

License

MIT