{"id":15366788,"url":"https://github.com/ryota-ka/duration","last_synced_at":"2025-04-15T12:31:23.834Z","repository":{"id":62435867,"uuid":"121675130","full_name":"ryota-ka/duration","owner":"ryota-ka","description":"A tiny compile-time time utility library, inspired by zeit/ms.","archived":false,"fork":false,"pushed_at":"2021-03-13T06:41:36.000Z","size":15,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T20:12:06.071Z","etag":null,"topics":["haskell","template-haskell","time"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/duration","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryota-ka.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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":"2018-02-15T19:51:58.000Z","updated_at":"2023-07-08T07:38:00.000Z","dependencies_parsed_at":"2022-11-01T21:16:59.425Z","dependency_job_id":null,"html_url":"https://github.com/ryota-ka/duration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryota-ka%2Fduration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryota-ka%2Fduration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryota-ka%2Fduration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryota-ka%2Fduration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryota-ka","download_url":"https://codeload.github.com/ryota-ka/duration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530604,"owners_count":21119601,"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":["haskell","template-haskell","time"],"created_at":"2024-10-01T13:19:50.716Z","updated_at":"2025-04-15T12:31:23.810Z","avatar_url":"https://github.com/ryota-ka.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# duration\n\nA tiny compile-time time utility library, inspired by [zeit/ms](https://github.com/zeit/ms).\n\n## Examples\n\n```haskell\n{-# LANGUAGE QuasiQuotes #-}\n{-# LANGUAGE TypeApplications #-}\n\nmodule Main where\n\nimport Data.Time.Clock (DiffTime, NominalDiffTime)\nimport Data.Time.Clock.Duration (t, s, ms, µs, ns, ps)\n\nmain :: IO ()\nmain = do\n    print @DiffTime [t| 1 day |] -- 86400s\n    print @DiffTime [t| 2h |]    -- 7200s\n    print @DiffTime [t| -1m |]   -- -60s\n\n    print @NominalDiffTime [s| 1 |]  -- 1s\n    print @NominalDiffTime [ms| 1 |] -- 0.001s\n    print @NominalDiffTime [µs| 1 |] -- 0.000001s\n    print @NominalDiffTime [ns| 1 |] -- 0.000000001s\n    print @NominalDiffTime [ps| 1 |] -- 0.000000000001s\n\n    print @Int      [s| 2 days |]  -- 172800\n    print @Integer  [ms| 5s |]     -- 5000\n    print @Double   [µs| 2min |]   -- 1.2e8\n    print @Float    [ns| -1 sec |] -- -1.0e9\n    print @Rational [ps| 10ms |]   -- 10000000000 % 1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryota-ka%2Fduration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryota-ka%2Fduration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryota-ka%2Fduration/lists"}