{"id":16724269,"url":"https://github.com/badboy/zeitstempel","last_synced_at":"2025-03-15T14:40:53.716Z","repository":{"id":54091637,"uuid":"344195197","full_name":"badboy/zeitstempel","owner":"badboy","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-18T08:09:35.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-14T19:52:11.616Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/badboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-03T16:43:29.000Z","updated_at":"2023-07-25T14:44:01.000Z","dependencies_parsed_at":"2022-08-13T06:40:29.200Z","dependency_job_id":null,"html_url":"https://github.com/badboy/zeitstempel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fzeitstempel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fzeitstempel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fzeitstempel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fzeitstempel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badboy","download_url":"https://codeload.github.com/badboy/zeitstempel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639489,"owners_count":20323507,"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":[],"created_at":"2024-10-12T22:44:33.041Z","updated_at":"2025-03-15T14:40:53.700Z","avatar_url":"https://github.com/badboy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zeitstempel\n\n[![Crates.io version](https://img.shields.io/crates/v/zeitstempel.svg?style=flat-square)](https://crates.io/crates/zeitstempel)\n[![docs.rs docs](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://docs.rs/zeitstempel)\n[![License: MPL 2.0](https://img.shields.io/github/license/badboy/zeitstempel?style=flat-square)](LICENSE)\n[![Build Status](https://img.shields.io/github/workflow/status/badboy/zeitstempel/CI?style=flat-square)](https://github.com/badboy/zeitstempel/actions?query=workflow%3ACI)\n\nzeitstempel is German for \"timestamp\".\n\n---\n\nTime's hard. Correct time is near impossible.\n\nThis crate has one purpose: give me a timestamp as an integer, coming from a monotonic clock\nsource, include time across suspend/hibernation of the host machine and let me compare it to\nother timestamps.\n\nIt becomes the developer's responsibility to only compare timestamps obtained from this clock source.\nTimestamps are not comparable across operating system reboots.\n\n# Why not `std::time::Instant`?\n\n[`std::time::Instant`] fulfills some of our requirements:\n\n[`std::time::Instant`]: https://doc.rust-lang.org/1.47.0/std/time/struct.Instant.html\n\n* It's monotonic, guaranteed ([sort of][rustsource]).\n* It can be compared to other timespans.\n\nHowever:\n\n* It can't be serialized.\n* It's not guaranteed that the clock source it uses contains suspend/hibernation time across all operating systems.\n\n[rustsource]: https://doc.rust-lang.org/1.47.0/src/std/time.rs.html#213-237\n\n# Example\n\n```rust\nuse std::{thread, time::Duration};\n\nlet start = zeitstempel::now();\nthread::sleep(Duration::from_millis(2));\n\nlet diff = Duration::from_nanos(zeitstempel::now() - start);\nassert!(diff \u003e= Duration::from_millis(2));\n```\n\n# Supported operating systems\n\nWe support the following operating systems:\n\n* Windows\\*\n* macOS\n* Linux\n* Android\n* iOS\n\nFor other operating systems there's a fallback to `std::time::Instant`,\ncompared against a process-global fixed reference point.\nWe don't guarantee that measured time includes time the system spends in sleep or hibernation.\n\n\\* To use native Windows 10 functionality enable the `win10plus` feature. Otherwise it will use the fallback.\n\n# License\n\nMPL 2.0. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fzeitstempel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadboy%2Fzeitstempel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fzeitstempel/lists"}