{"id":20704122,"url":"https://github.com/solidsnack/short-duration-presentation","last_synced_at":"2026-06-08T07:33:35.354Z","repository":{"id":169910714,"uuid":"646000511","full_name":"solidsnack/short-duration-presentation","owner":"solidsnack","description":"Short Formats for Short Durations","archived":false,"fork":false,"pushed_at":"2023-06-27T05:42:38.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-02T10:27:23.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/solidsnack.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-27T01:24:29.000Z","updated_at":"2026-03-30T05:42:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b1c9872-340f-4ae8-a902-37ffb13b29f0","html_url":"https://github.com/solidsnack/short-duration-presentation","commit_stats":null,"previous_names":["solidsnack/short-duration-presentation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/solidsnack/short-duration-presentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Fshort-duration-presentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Fshort-duration-presentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Fshort-duration-presentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Fshort-duration-presentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidsnack","download_url":"https://codeload.github.com/solidsnack/short-duration-presentation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidsnack%2Fshort-duration-presentation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34053435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":[],"created_at":"2024-11-17T01:11:09.896Z","updated_at":"2026-06-08T07:33:35.324Z","avatar_url":"https://github.com/solidsnack.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Short Formats for Short Durations\n\n| `present(seconds: f64)` | formatted result |\n| ------------- | ------------- |\n| `present(0.01)` | `010ms` |\n| `present(1.0)` | `1.00s` |\n| `present(10.0)` | `10.0s` |\n| `present(100.0)` | `1m40s` |\n| `present(1000.0)` | `0h17m` |\n| `present(10000.0)` | `2h47m` |\n| `present(100000.0)` | `1d04h` |\n| `present(1000000.0)` | `01w5d` |\n| `present(10000000.0)` | `16w4d` |\n| `present(100000000.0)` | `3y09w` |\n| `present(1000000000.0)` | `0032y` |\n| `present(10000000000.0)` | `0317y` |\n\n## Formats \u0026 Ranges Covered\n\n| format | smallest unit multiple | range multiple | values covered |\n| ------------- | ------------- | ------------- | ------------- |\n| `000ms` |          |             | up to 00.9995000000s |\n| `0.00s` | 10×      |   10×       | up to 09.9950000000s |\n| `00.0s` | 10×      |   10×       | up to 99.950000000s (about 1½ minutes) |\n| `0m00s` | 10×      |    6×       | up to 09m59.5s |\n| `0h00m` | 60×      |   60×       | up to 09h59m30s |\n| `0d00h` | 60×      |   24×       | up to 9d23h30m |\n| `00w0d` | 24×      |   70×       | up to 99w6d12h (about 1 year, 9 months) |\n| `0y00w` |  7×      |    5.21775× | up to 9y51w4d02h54m36s |\n| `0000y` | 52.1775× | 1000×       | up to 9999y26w0d14h54m36s |\n| `10ky+` |          |             | values outside representation range |\n\nAs regular expressions:\n\n| format | matcher |\n| ------------- | ------------- |\n| `000ms` | `([0-9][0-9][0-9])ms` |\n| `0.00s` | `([0-9][.][0-9][0-9])s` |\n| `00.0s` | `([0-9][0-9][.][0-9])s` |\n| `0m00s` | `([0-9])m([0-9][0-9])s` |\n| `0h00m` | `([0-9])h([0-9][0-9])m` |\n| `0d00h` | `([0-9])d([0-9][0-9])h` |\n| `00w0d` | `([0-9][0-9])w([0-9])d` |\n| `0y00w` | `([0-9])y([0-9][0-9])w` |\n| `0000y` | `([0-9][0-9][0-9][0-9])y` |\n| `10ky+` | `10ky[+]` |\n\n## The Rounding Rules for Years\n\nFor units longer than a second, there is some ambiguity as to their actual\nduration. In UTC timekeeping, a \"leap second\" is occasionally\nintroduced into the last minute (and thus last hour and day) of a year; and\neven if we set aside the leap second and adopt fixed minutes, hours and days\n(the \"SI Day\" of 86400 seconds), there is also the matter of leap years, of\nwhich there are 97 every 400 years.\n\nThe average Gregorian year is 365.2425 SI days, which provides a simple basis\nfor our calculations that is quite accurate for many purposes, and certainly\nfor giving a sense of time elapsed when many years have passed; but the year\nis nevertheless a complex case for rounding because it is a non-integer number\nof days and a non-integer number of weeks (52 weeks is 364 days).\n\nWe can ask two questions to come up with rounding rules for years:\n\n1. When is a time between `1y51m` and `2y00w` closer to  `2y00w` ?\n2. When is a time between `0019y` and `0020y` closer to  `0020y` ?\n\nThe answer to the first question helps us to set the upper limit for the\nformat `0y00w`, while the answer to second helps us to set the upper limit for\nthe format `0000y`, as well as helping us to round values:\n\n1. From `1y51w0d` to `2y00w0d` we have 712152 seconds or `8d05h49m12s` . The\n   point where we get closer to `2y00w` is 356076 seconds or `4d02h54m36s`.\n2. From `0019y00w0d` to `0020y00w0d` there are 31556952 seconds. Half this\n   value is 15778476 seconds, or `26w0d14h54m36s`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidsnack%2Fshort-duration-presentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidsnack%2Fshort-duration-presentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidsnack%2Fshort-duration-presentation/lists"}