{"id":13478224,"url":"https://github.com/metrics-rs/quanta","last_synced_at":"2025-05-14T06:12:23.536Z","repository":{"id":38785869,"uuid":"165332779","full_name":"metrics-rs/quanta","owner":"metrics-rs","description":"high-speed timing library in Rust","archived":false,"fork":false,"pushed_at":"2025-01-01T23:06:29.000Z","size":332,"stargazers_count":333,"open_issues_count":16,"forks_count":36,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-07T19:00:59.544Z","etag":null,"topics":["rust-lang","timestamp","timing"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/metrics-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-12T01:22:34.000Z","updated_at":"2025-04-02T16:44:05.000Z","dependencies_parsed_at":"2024-01-16T06:18:55.069Z","dependency_job_id":"37f80bdb-9993-4217-b8a0-004c34383947","html_url":"https://github.com/metrics-rs/quanta","commit_stats":{"total_commits":172,"total_committers":19,"mean_commits":9.052631578947368,"dds":0.2441860465116279,"last_synced_commit":"79e5aea5c6d2e09fd94cadf07101d8c50ac79500"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metrics-rs%2Fquanta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metrics-rs%2Fquanta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metrics-rs%2Fquanta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metrics-rs%2Fquanta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metrics-rs","download_url":"https://codeload.github.com/metrics-rs/quanta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968737,"owners_count":21191159,"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","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":["rust-lang","timestamp","timing"],"created_at":"2024-07-31T16:01:54.203Z","updated_at":"2025-04-14T22:05:32.350Z","avatar_url":"https://github.com/metrics-rs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# quanta\n\n[![conduct-badge][]][conduct] [![gh-actions-badge][]][gh-actions] [![downloads-badge][] ![release-badge][]][crate] [![docs-badge][]][docs] [![libraries-io-badge][]][libraries-io] [![license-badge][]](#license)\n\n[conduct-badge]: https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg\n[gh-actions-badge]: https://github.com/metrics-rs/quanta/workflows/Rust/badge.svg\n[downloads-badge]: https://img.shields.io/crates/d/quanta.svg\n[release-badge]: https://img.shields.io/crates/v/quanta.svg\n[license-badge]: https://img.shields.io/crates/l/quanta.svg\n[docs-badge]: https://docs.rs/quanta/badge.svg\n[libraries-io-badge]: https://img.shields.io/librariesio/github/metrics-rs/quanta.svg\n[libraries-io]: https://libraries.io/cargo/quanta\n[conduct]: https://github.com/metrics-rs/quanta/blob/main/CODE_OF_CONDUCT.md\n[gh-actions]: https://github.com/metrics-rs/quanta/actions\n[crate]: https://crates.io/crates/quanta\n[docs]: https://docs.rs/quanta\n\n__quanta__ is a high-speed timing library, useful for getting the current time _very quickly_, as well as manipulating\nit.\n\n## code of conduct\n\n**NOTE**: All conversations and contributions to this project shall adhere to the [Code of Conduct][conduct].\n\n## usage\n\nThe API documentation of this library can be found at [docs.rs/quanta](https://docs.rs/quanta/).\n\n## general features\n- count CPU cycles via Time Stamp Counter (TSC). or\n- get monotonic time, in nanoseconds, based on TSC (or OS fallback)\n- extremely low overhead where possible\n- mockable\n- cross-platform\n- fun, science-y name!\n\n## platform / architecture support\n\nFor most major platforms -- Linux, Windows, and macOS -- with processors made around or after 2008, you should have no\nproblems using `quanta` with full TSC support. `quanta` will always fallback to the included stdlib timing facilities if\nTSC support is not present. The biggest caveat to this, as evidenced in the compatibility matrix below, is that we only\nsupport the TSC on `x86`/`x86_64` platforms.\n\n\n| Platform             | stdlib fallback | TSC support? | CI tests? |\n|----------------------|-----------------|--------------|-----------|\n| Linux (x86/x86_64)   | ✅               | ✅           | ✅        |\n| Linux (MIPS/ARM)     | ✅               | ❌           | ✅        |\n| Windows (x86/x86_64) | ✅               | ✅           | ✅        |\n| Windows (ARM)        | ✅               | ❌           | ❌        |\n| macOS (x86/x86_64)   | ✅               | ✅           | ✅        |\n| macOS (ARM)          | ✅               | ❌           | ❌        |\n| iOS (ARM)            | ✅               | ❌           | ❌        |\n\n## performance\n\n`quanta` sits neck-and-neck with native OS time facilities: the cost of `Clock::now` is on par `Instant::now` from the\nstdlib, if not better.\n\n## why use this over stdlib?\n\nBeyond having a performance edge in specific situations, the ability to use mocked time makes it easier to actually test\nthat your application is doing the right thing when time is involved.\n\nAdditionally, and as mentioned in the general features section, `quanta` provides a safe/thin wrapper over accessing the\nTime Stamp Counter, which allows measuring cycle counts over short sections of code.  This can be relevant/important for\naccurately measuring performance-critical sections of code.\n\n## alternative crates\n\n- [`chrono`](https://docs.rs/chrono):\n  - based on `std::time::SystemTime`: non-monotonic reads\n  - focused on timezone-based \"date/time\" measurements, not intervals/elapsed time\n  - clock cannot be altered at all (no pause, no discrete updates)\n- [`time`](https://docs.rs/time):\n  - based on `std::time::SystemTime` and `std::time::Instant`:\n    - `time::Time`/`time::PrimitiveDateTime` use `SystemTime`: non-monotonic reads\n    - `time::Instant` uses `Instant`: monotonic reads\n  - focused on timezone-based \"date/time\" measurements, not interval/elapsed time\n  - clock cannot be altered at all (no pause, no discrete updates)\n- [`clock`](https://docs.rs/clock):\n  - based on `std::time::SystemTime`: non-monotonic reads\n  - clock can be swapped (trait-based)\n  - no free function for acquiring time\n- [`clocksource`](https://docs.rs/clocksource):\n  - based on TSC w/ OS fallback; non-monotonic reads\n  - clock cannot be altered at all (no pause, no discrete updates)\n  - depends on unstable `asm!` macro + feature flag to enable TSC\n  - no free function for acquiring time\n- [`pausable_clock`](https://docs.rs/pausable_clock):\n  - based on `std::time::Instant`: monotonic reads\n  - clock can be paused (time can be delayed, but not discretely updated)\n  - no free function for acquiring time\n\n## license\n\n__quanta__ is licensed under the MIT license. ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetrics-rs%2Fquanta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetrics-rs%2Fquanta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetrics-rs%2Fquanta/lists"}