{"_id":"approximate-now","_rev":"3-be613671bf2b35756d9214580e0293ba","name":"approximate-now","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"extensions":["ts"],"files":["test/approximate-now/**/*"],"require":["ts-node/register/transpile-only"]},"description":"Approximate (fast) current UNIX time.","devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","ava":"^3.14.0","benchmark":"^2.1.4","coveralls":"^3.1.0","del-cli":"^3.0.1","delay":"^4.4.0","eslint":"^7.16.0","eslint-config-canonical":"^24.4.4","husky":"^4.3.6","nyc":"^15.1.0","semantic-release":"^17.3.0","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0"},"husky":{"hooks":{"pre-commit":"npm run lint && npm run test && npm run build"}},"keywords":["log","logger","json"],"license":"BSD-3-Clause","main":"./dist/approximateNow.js","name":"approximate-now","repository":{"type":"git","url":"git+ssh://git@github.com/gajus/approximate-now.git"},"scripts":{"benchmark":"ROARR_LOG=true ts-node --transpile-only test/benchmark.ts","build":"del-cli ./dist && tsc","create-readme":"gitdown ./.README/README.md --output-file ./README.md","dev":"tsc --watch","lint":"eslint ./src ./test && tsc --noEmit","test":"NODE_ENV=test ava --serial --verbose"},"typings":"./dist/approximateNow.d.ts","version":"1.0.0","gitHead":"5dcaff55ea0f3426a049c20c393ea6c9ca8d027e","bugs":{"url":"https://github.com/gajus/approximate-now/issues"},"homepage":"https://github.com/gajus/approximate-now#readme","_id":"approximate-now@1.0.0","_nodeVersion":"15.5.0","_npmVersion":"6.14.10","dist":{"integrity":"sha512-n8SkhunMoE1jYuC70sAof82NvFXhxHRSxQxk2Zl2+SpFraLE9rKkSMi+KumnXXukhPWe5iUa6cO4535ePtovQQ==","shasum":"00f80e42309f2b5518402daba8595c4206e1bf73","tarball":"https://registry.npmjs.org/approximate-now/-/approximate-now-1.0.0.tgz","fileCount":6,"unpackedSize":6819,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5mzCCRA9TVsSAnZWagAAUDcP/0mxEe70OZ9SFwO/rPHk\nKYUDAiv7Om6K8yut0nBDXeqr7d7BliiMufAUoKSYmigwQbusSJlehcIcPn56\n/k3FvIMVQMxXyLmMUmOKDcCss44BZDYG/8ha6J3xL8q8Pn4Pie0ulaF0lMDS\nUWvrDUfBOPJOzKxiCr7CVFMV0FI095ccCyJndok1h6yVBjghozGaLGz1t3YL\n29oQAiN65eFpsFpIM5nIXVEWvQA0HPeqfR3yQyqMN2t96eTkfI3rOuWF2cS6\nug21MC7TCt3Zb9rR8OaV81haZ0gvK4JIRf8fzDcRkUttKyiraQlFLlEGf9kW\nTtQr00Af0x0+9skVr6Jm5RIrX3eW05eAa85ySx7nx0Msxc/gi8qAkp48XcGY\nMCSwZsNFXJFuGVoBDXHzorr3wSrjsuHa+ge+muTamsq/a507nm/0n67kdZYv\nbhGDfZlcJO2KJg+h3Bmr21uG4oddRjF2o2P7MWLu2iqYrVnwMcyBOUtD+Ilh\n8R7YNTwKuBtpCYO8ps48Cm+Jgs0LMzMXtXD1sN4PuAkG5f5yfo86eL+HK2k9\n0tMKPIbfYmnpYBIFARTeqfTgmdp3iS1No6AA+mQPD2SndLauv2mWFtGFTnQJ\nieBgUYIGWKaiw0pkU2oVCyq5eEw3X7psXVqW39wTaQRkRspUeN/dbnBmzrOV\nHNAx\r\n=kdMe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCV7EpoaqVmkQ4F76tsS57h52ZT59VrzPixwPmEnyF2wgIhAIIBH/AC0TN/g+pQwgH6q/kIthqwyQPv1LG5+3sPGVaF"}]},"_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"directories":{},"maintainers":[{"name":"gajus","email":"gajus@gajus.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/approximate-now_1.0.0_1608936641882_0.8685191623913973"},"_hasShrinkwrap":false},"1.0.1":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"extensions":["ts"],"files":["test/approximate-now/**/*"],"require":["ts-node/register/transpile-only"]},"description":"Approximate (fast) current UNIX time.","devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","ava":"^3.14.0","benchmark":"^2.1.4","coveralls":"^3.1.0","del-cli":"^3.0.1","delay":"^4.4.0","eslint":"^7.16.0","eslint-config-canonical":"^24.4.4","husky":"^4.3.6","nyc":"^15.1.0","semantic-release":"^17.3.0","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0"},"husky":{"hooks":{"pre-commit":"npm run lint && npm run test && npm run build"}},"keywords":["log","logger","json"],"license":"BSD-3-Clause","main":"./dist/approximateNow.js","name":"approximate-now","repository":{"type":"git","url":"git+ssh://git@github.com/gajus/approximate-now.git"},"scripts":{"benchmark":"ROARR_LOG=true ts-node --transpile-only test/benchmark.ts","build":"del-cli ./dist && tsc","create-readme":"gitdown ./.README/README.md --output-file ./README.md","dev":"tsc --watch","lint":"eslint ./src ./test && tsc --noEmit","test":"NODE_ENV=test ava --serial --verbose"},"typings":"./dist/approximateNow.d.ts","version":"1.0.1","gitHead":"f434964c74f42c4b895820c9818c60e7488a777d","bugs":{"url":"https://github.com/gajus/approximate-now/issues"},"homepage":"https://github.com/gajus/approximate-now#readme","_id":"approximate-now@1.0.1","_nodeVersion":"15.5.0","_npmVersion":"6.14.10","dist":{"integrity":"sha512-HN76o5vvS3VhmLTp/Z2/U7dVUR5egReXXb4k14EUJW0ydmNIZy1WE2JI/PmMLpfc/C+3gnM8CbjKtv0Vne5R2A==","shasum":"824fd836a54f1afc4dd5e41dc3dca134185e823f","tarball":"https://registry.npmjs.org/approximate-now/-/approximate-now-1.0.1.tgz","fileCount":6,"unpackedSize":6825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5pVVCRA9TVsSAnZWagAAVxEP/A4IkhGfQ8nkSPfEVIn6\ntCA5I9EsMyVO2EmqrS9G66Ul4x2p1JwnghpJFsTKswmpMoVjaTQmi0MoT5pC\nIoDeYPNu5F73uhGUcCirZDG6g3Gx8YY2MS1bwWhZ0pltHAYDyrWgoGdh5FWY\nou8KuIGP+PN6kHj5MH7N199e1C6SVrcN9LT4B+PYgCxEUXvOGNkBcSdlm+sX\nts6FNm4yUwzzSxoYMgwRDuTF023ivw3BJ0ki8ybjdH6DOxhdZ6tCPtdk2UXE\nERvVktnYioSLfepbVgoNXR9yovDRD0zqgh99J6mY5mLXRx+ROSvVBDN8FbyO\n8g+4vUQZ9Ne/fMBVD12+T5R+Jqgf8srifB1DIphPEReOFR714hYojM5eXDhO\ni/4PqzIoZ1V/Wo5gCMgK8uQRnSEihI+J/9ocSsCcxqUe0uwLZrbROzobme7U\ndU95R6ZBOSJkic41c5IGI5m0Z1kcF3t0U2OGX2HPnIsl2nwAoIYU6XptxTA0\nRrq+WYmQ/xTYI27u8ehMPn1xgSCNhl4tRtR8GjlvIdmmQq7ZkckoCDrrJ3dH\nEHHFf4XYp7JWwQzyyG0wmTakce9puxhV+vYszhWAtC7ZZhRlrVR/MDuFhpWN\ndXrRqBnKyVDJs0Ieg/UdyrJwAfXDQTRdzwS79wu33mySROiwWe9o8A46g+Wf\nO9IT\r\n=85ug\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrx6liJHblu67sTzIBA4rWrX+x8f+wplgCiaaVRo1oYQIhAMM3ulGKBMBogVCTn5oB+4H/LX0NTzSZCNzv/dxMeylv"}]},"_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"directories":{},"maintainers":[{"name":"gajus","email":"gajus@gajus.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/approximate-now_1.0.1_1608947029095_0.5208004461867293"},"_hasShrinkwrap":false},"1.0.2":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"extensions":["ts"],"files":["test/approximate-now/**/*"],"require":["ts-node/register/transpile-only"]},"description":"Approximate (fast) current UNIX time.","devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","ava":"^3.14.0","benchmark":"^2.1.4","coveralls":"^3.1.0","del-cli":"^3.0.1","delay":"^4.4.0","eslint":"^7.16.0","eslint-config-canonical":"^24.4.4","husky":"^4.3.6","nyc":"^15.1.0","semantic-release":"^17.3.0","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0"},"husky":{"hooks":{"pre-commit":"npm run lint && npm run test && npm run build"}},"keywords":["log","logger","json"],"license":"BSD-3-Clause","main":"./dist/approximateNow.js","name":"approximate-now","repository":{"type":"git","url":"git+ssh://git@github.com/gajus/approximate-now.git"},"scripts":{"benchmark":"ROARR_LOG=true ts-node --transpile-only test/benchmark.ts","build":"del-cli ./dist && tsc","create-readme":"gitdown ./.README/README.md --output-file ./README.md","dev":"tsc --watch","lint":"eslint ./src ./test && tsc --noEmit","test":"NODE_ENV=test ava --serial --verbose"},"typings":"./dist/approximateNow.d.ts","version":"1.0.2","gitHead":"6ea8bab38d13a6afbe456714136c9adfa0590f96","bugs":{"url":"https://github.com/gajus/approximate-now/issues"},"homepage":"https://github.com/gajus/approximate-now#readme","_id":"approximate-now@1.0.2","_nodeVersion":"15.5.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-r0PAP7S9VaWCQEZT+loOnZRM0gj30L/S5oB9SKTuMXGhQLycvnh9gKFhu2Kq89dJkjAWf7m8PH4xy7OamBElwQ==","shasum":"f72310c2aae8625d5f1ed8031005ce8ae16a0000","tarball":"https://registry.npmjs.org/approximate-now/-/approximate-now-1.0.2.tgz","fileCount":6,"unpackedSize":6892,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/eGtCRA9TVsSAnZWagAAPfMP/3DnYNaiRoiZiRB8xlI/\ngu++R1G7DgBpBuXP+VeFLwoescr55SI5DDK9EdA5/xjy+fCLnhzfNIjXUsNh\ne3dn8UHF+Fvz+UYucRrLo8kIyJxwcdDwLR+8lDZqVHWWyTYYYs3kUWGDEn5L\nSWv0mvuov7htdpYUmnNBejlV0P5kDvyJUdgNsXdTzoBLxm1KQDMpsqEs7gO/\nSedaQvHIJIN/wj0hRqCVYfufOrlmpIZ9wm0rR0xBgzNA1r94sK8lfs1mgNlM\n2V23oUwjmxxpzhIejdFaChc5XEy7yLu4W7pShuuc6xMe0ugfXwi2ziYiHZi+\nWZ/JFJgSSE82s8Kp9Arrd+SHrezC33vUnglEwjx+eCvmZYWIqz0lfMtC2Bwy\nXfbXL3nAlmoo31sbDEQ6iaCoVTUctqL0keztvIoJEpOiNbMLRYWHu1kc33Bj\n8D+V9UAqhCb0keG6m3b2Rhkbu08NtdXl0RVBH1aC/dxfuFP/OZ2v5XgYIa7k\nCA9Hx0l7SaREn9CElMqR1PjaE/BCGUS1H0jmqE96SA0vf+7rycBfYwWD1MiG\nw1+K0B37zKeuccBnJJl2u+3zOGYWOqv8uKQerwH3ocMTlbljI2+2jY+pZEpi\nmNWfQRH9PVtiXZJyh1nH41m7v0JOBShKy2MlH7fwYDudnDkOGO2N6nkmqj0d\nQtSD\r\n=alk3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLW4HqUq2+lU74WL5NdaUjwinQGN5zUJjKcuDE5z3VewIhAKO2YdxuPVWjkG27oSsR70SwjpZJRRjOhhRVncmK02sC"}]},"_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"directories":{},"maintainers":[{"name":"gajus","email":"gajus@gajus.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/approximate-now_1.0.2_1610473900739_0.8289720405846814"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-25T22:50:41.882Z","1.0.0":"2020-12-25T22:50:42.026Z","modified":"2022-04-11T14:55:11.048Z","1.0.1":"2020-12-26T01:43:49.256Z","1.0.2":"2021-01-12T17:51:40.898Z"},"maintainers":[{"name":"gajus","email":"gajus@gajus.com"}],"description":"Approximate (fast) current UNIX time.","homepage":"https://github.com/gajus/approximate-now#readme","keywords":["log","logger","json"],"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/approximate-now.git"},"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"bugs":{"url":"https://github.com/gajus/approximate-now/issues"},"license":"BSD-3-Clause","readme":"# approximate-now\n\n[![Travis build status](http://img.shields.io/travis/gajus/approximate-now/master.svg?style=flat-square)](https://travis-ci.org/gajus/approximate-now)\n[![Coveralls](https://img.shields.io/coveralls/gajus/approximate-now.svg?style=flat-square)](https://coveralls.io/github/gajus/approximate-now)\n[![NPM version](http://img.shields.io/npm/v/approximate-now.svg?style=flat-square)](https://www.npmjs.org/package/approximate-now)\n[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)\n[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas)\n\nApproximate (fast) current UNIX time.\n\n## Motivation\n\nSometimes you don't care about the exact time the event took place, but rather need to know approximately when. If your use case is performance sensitive, then `Date.now()` might not be the best option because it has a [measurable impact](#benchmark) to the performance. `approximate-now` provides an approximate (to the error of 50ms) time without a performance penalty of `Date.now()`.\n\n## Usage\n\n```js\nimport {\n  approximateTime,\n} from 'approximate-now';\n\n// `approximateTime.now` value is updated by reference every 50ms.\nconsole.log(approximateTime.now);\n\n```\n\n## Sequence guarantee\n\nIt is guaranteed that two consequent attempts to retrieve time within the same 50ms time window will have unique values, i.e.\n\nAssuming that the current time is `0000000000000`, then:\n\n```js\napproximateTime.now; // 0000000000000\napproximateTime.now; // 0000000000001\napproximateTime.now; // 0000000000002\n\n```\n\nHowever, if `approximateTime.now` is accessed more than 50 times within the same 50ms time window, then the top-most value within that interval is returned repeatedly.\n\n```js\napproximateTime.now; // 0000000000000\napproximateTime.now; // 0000000000001\napproximateTime.now; // 0000000000002\n\n// approximateTime.now x 50\napproximateTime.now; // 0000000000050\napproximateTime.now; // 0000000000050\napproximateTime.now; // 0000000000050\n\n```\n\n## benchmark\n\n```\nDate.now()          x 19,900,411 ops/sec ±0.59% (93 runs sampled)\napproximateTime.now x 82,420,291 ops/sec ±0.83% (92 runs sampled)\n\n```\n\n## Use cases\n\nAny sort of time-sensitive operations when it is sufficient to retrieve an approximate timestamp, e.g. [`roarr`](https://github.com/gajus/roarr) logger uses `approximate-now` to record the time when a log message was produced.\n","readmeFilename":"README.md"}