{"id":22276020,"url":"https://github.com/juliyvchirkov/process-timer","last_synced_at":"2026-05-14T13:42:37.593Z","repository":{"id":57330866,"uuid":"145123183","full_name":"juliyvchirkov/process-timer","owner":"juliyvchirkov","description":"High-resolution timer class for NodeJs \u0026 browsers","archived":false,"fork":false,"pushed_at":"2022-12-16T13:03:22.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T10:40:01.552Z","etag":null,"topics":["browser","class","development","epoch","es5","high-resolution","hrtime","javascript","microseconds","milliseconds","nanoseconds","nodejs","performance","process","profiling","time","timer","timestamp","tool","utility"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliyvchirkov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"liberapay":"juliyvchirkov"}},"created_at":"2018-08-17T13:22:40.000Z","updated_at":"2023-04-11T15:23:49.000Z","dependencies_parsed_at":"2023-01-29T14:00:33.872Z","dependency_job_id":null,"html_url":"https://github.com/juliyvchirkov/process-timer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/juliyvchirkov/process-timer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliyvchirkov%2Fprocess-timer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliyvchirkov%2Fprocess-timer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliyvchirkov%2Fprocess-timer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliyvchirkov%2Fprocess-timer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliyvchirkov","download_url":"https://codeload.github.com/juliyvchirkov/process-timer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliyvchirkov%2Fprocess-timer/sbom","scorecard":{"id":542416,"data":{"date":"2025-08-11","repo":{"name":"github.com/juliyvchirkov/process-timer","commit":"c33e7b4a29846b603be21bb316904df154f8b894"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T08:32:56.642Z","repository_id":57330866,"created_at":"2025-08-20T08:32:56.643Z","updated_at":"2025-08-20T08:32:56.643Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279085187,"owners_count":26100015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","class","development","epoch","es5","high-resolution","hrtime","javascript","microseconds","milliseconds","nanoseconds","nodejs","performance","process","profiling","time","timer","timestamp","tool","utility"],"created_at":"2024-12-03T14:13:10.634Z","updated_at":"2025-10-15T14:12:45.284Z","avatar_url":"https://github.com/juliyvchirkov.png","language":"JavaScript","funding_links":["https://liberapay.com/juliyvchirkov"],"categories":[],"sub_categories":[],"readme":"# ProcessTimer\n**High-resolution timer class** \u003ca href=\"https://github.com/juliyvchirkov/process-timer\"\u003e\u003cimg src=\"https://github.com/favicon.ico\" width=\"20\" height=\"20\" valign=\"middle\" \u003e\u003c/a\u003e \u003ca href=\"https://www.npmjs.com/package/process-timer\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/6078720?s=20\u0026v=4\" width=\"20\" height=\"20\" valign=\"middle\"\u003e\u003c/a\u003e \u003ca href=\"https://www.jsdelivr.com/package/npm/process-timer\"\u003e\u003cimg src=\"https://data.jsdelivr.com/v1/package/npm/process-timer/badge?style=rounded\" valign=\"middle\"\u003e\u003c/a\u003e \n\nImplements timestamps processing in a handy simple way\n\n```javascript\n /**\n  * ProcessTimer {\n  *     VERSION : '1.0.2',\n  *     nsec : [Getter],\n  *     usec : [Getter],\n  *     msec : [Getter],\n  *     sec : [Getter]\n  *     ns : [Getter],\n  *     us : [Getter],\n  *     ms : [Getter],\n  *     s : [Getter]\n  * }\n  */\n```\n\nDesigned to cover any version of NodeJs \u0026 almost any browser being in use nowadays\n\nUtilizes `process.hrtime` method if available (NodeJs v0.7.6 \u0026 above), falls back to `performance.now` if available (modern browsers), in turn falls back to `Date.now` (legacy browsers \u0026 NodeJs v0.7.5 \u0026 below) \n\n## Install\n\n**NodeJs**\n\n```bash\nnpm install process-timer\n```\n\n**A browser**\n\nObtain from \u003ca href=\"https://www.jsdelivr.com/package/npm/process-timer\"\u003e\u003cimg src=\"https://www.jsdelivr.com/img/logo.png\" valign=\"middle\" width=\"80\" height=\"20\"\u003e\u003c/a\u003e\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/process-timer@1/process-timer.min.js\" async\u003e\u003c/script\u003e\n```\n\n## Usage\n\n**NodeJs**\n\n```javascript\nconst ProcessTimer = require('process-timer')\nconst timer = new ProcessTimer()\n```\n\n**A browser**\n\n```javascript\nvar timer = new ProcessTimer()\n```\n\nRetrieving a timestamp\n\n```javascript\n/**\n * A number of seconds (accurate to nanoseconds) \n * elapsed since a timer has been instantiated\n */\nconsole.log(timer.ns)\n\n/**\n * A number of seconds (accurate to microseconds) \n * elapsed since a timer has been instantiated\n */\nconsole.log(timer.us)\n\n/**\n * A number of seconds (accurate to milliseconds) \n * elapsed since a timer has been instantiated\n */\nconsole.log(timer.ms)\n\n/**\n * A number of seconds elapsed since a timer \n * has been instantiated\n */\nconsole.log(timer.s)\n\n/**\n * A number of nanoseconds elapsed since a timer \n * has been instantiated\n */\nconsole.log(timer.nsec)\n\n/**\n * A number of microseconds elapsed since a timer \n * has been instantiated\n */\nconsole.log(timer.usec)\n\n/**\n * A number of milliseconds elapsed since a timer \n * has been instantiated\n */\nconsole.log(timer.msec)\n\n/**\n * A number of seconds elapsed since a timer \n * has been instantiated\n */\nconsole.log(timer.sec)\n```\n\n## Samples\n\nThe most common use case\n\n```javascript\nconst ProcessTimer = require('process-timer')\n/**\n * Launching a timer\n */\nconst timer = new ProcessTimer()\n\ntry {\n    /**\n     * … processing …\n     */\n\n    /**\n     * Retrieving a number of seconds (accurate to microseconds) to note the milestone\n     */\n     console.log('Code block of Subroutine #14 has been reached on %s sec', timer.us)\n\n    /**\n     * Subroutine #14\n     */\n    if (['-?', '-h', '--help', '--usage'].includes(process.argv[2])) {\n        /**\n         * Launching another timer inside the subroutine\n         */\n        const subroutineTimer = new ProcessTimer()\n\n         /**\n          * … processing …\n          */\n\n         /**\n          * Retrieving a number of seconds (accurate to microseconds) to note\n          * the completion of subroutine\n          */\n         console.log('Subroutine #14 time: %s sec', subroutineTimer.us)\n    }\n\n   /**\n    * … processing …\n    */\n\n   /**\n    * Retrieving a number of seconds (accurate to microseconds)\n    * to note the completion\n    */\n    console.log('Total time: %s sec', timer.us)\n} catch (error) {\n    /**\n     * Retrieving a number of seconds (accurate to nanoseconds)  \n     * elapsed before a failure\n     */\n    console.error('Crashed on %s sec\\n%s', timer.ns, error.stack)\n}\n```\n\nRetrieving a number of nanoseconds / microseconds / milliseconds / seconds per se\n\n```javascript\nconst ProcessTimer = require('process-timer')\nconst timer = new ProcessTimer()\n\ntry {\n    /**\n     * … processing …\n     */\n\n    /**\n     * Retrieving a number of microseconds to note a milestone\n     */\n    console.log('Got here after %s μs', timer.usec)\n\n    /**\n     * … processing …\n     */\n\n    /**\n     * Retrieving a number of seconds along w/ a number of millisecond\n     * to note the completion\n     */\n    console.log('Total time: %s sec (%s ms)', timer.sec, timer.msec)    \n} catch (error) {\n    /**\n     * Retrieving a number of nanoseconds elapsed before a failure\n     */\n    console.error('Crashed on %s ns\\n%s', timer.nsec, error.stack)\n}\n```\n\nThe constructor accepts a text suffix to append an outcome of `timer.ns`, `timer.us`, `timer.ms` \u0026 `timer.s` (needless to say this suffix turns the type of outcome of these getters from `Number` into `String`)\n\n```javascript\nconst ProcessTimer = require('process-timer')\nconst timer = new ProcessTimer('s')\n\nsetTimeout(() =\u003e {\n    const milestone = timer.us\n    \n    /**\n     * Expected output:\n     * 'string'\n     * '8.008321s'\n     */\n    console.log(typeof milestone)\n    console.log(milestone)\n}, 8000)\n```\n\nHint: one can pass an empty suffix to the constructor to force the type of outcome of the above quadruplet to become `String` w/ no appendix\n\n```javascript\nconst ProcessTimer = require('process-timer')\nconst timer = new ProcessTimer('')\n\nsetTimeout(() =\u003e {\n    const milestone = timer.us \n    \n    /**\n     * Expected output:\n     * 'string'\n     * '8.008321'\n     */\n    console.log(typeof milestone)\n    console.log(milestone)\n}, 8000)\n```\n\n## Bugs\n\nIf you have faced some bug, please [follow this link to create the issue](https://github.com/juliyvchirkov/process-timer/issues) \u0026 thanks for your time \u0026 contribution in advance!\n\n**glory to Ukraine!** 🇺🇦\n\nJuliy V. Chirkov, [twitter.com/juliychirkov](https://twitter.com/juliychirkov)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliyvchirkov%2Fprocess-timer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliyvchirkov%2Fprocess-timer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliyvchirkov%2Fprocess-timer/lists"}