{"id":16019576,"url":"https://github.com/iboard/timewrap","last_synced_at":"2026-01-20T11:32:27.452Z","repository":{"id":62430456,"uuid":"170092667","full_name":"iboard/timewrap","owner":"iboard","description":"A Time-Wrapper For Elixir","archived":false,"fork":false,"pushed_at":"2019-03-02T20:31:05.000Z","size":33,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T14:34:14.634Z","etag":null,"topics":["elixir","elixir-lang","hex","testing"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/timewrap","language":"Elixir","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/iboard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-11T08:22:32.000Z","updated_at":"2019-03-02T20:31:06.000Z","dependencies_parsed_at":"2022-11-01T20:30:46.276Z","dependency_job_id":null,"html_url":"https://github.com/iboard/timewrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iboard/timewrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Ftimewrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Ftimewrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Ftimewrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Ftimewrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboard","download_url":"https://codeload.github.com/iboard/timewrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Ftimewrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28602458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T10:46:13.255Z","status":"ssl_error","status_checked_at":"2026-01-20T10:42:51.865Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["elixir","elixir-lang","hex","testing"],"created_at":"2024-10-08T17:04:49.075Z","updated_at":"2026-01-20T11:32:27.436Z","avatar_url":"https://github.com/iboard.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timewrap\n[![Documentation](https://img.shields.io/badge/docs-hexpm-blue.svg)](http://hexdocs.pm/timewrap/)\n[![Documentation](https://travis-ci.com/iboard/timewrap.svg?branch=master)](https://travis-ci.com/iboard/timewrap)\n\nTimewrap is a \"Time-Wrapper\" through which you can access different\ntime-sources, Elixir and Erlang offers you. Other than that you \ncan implement on your own.\n\nAlso, _Timewrap_ can do the time-warp, freeze, and unfreeze a \n`Timewrap.Timer`.\n\nYou can instantiate different `Timewrap.Timer`s, registered and\nsupervised by `:name`.\n\nThe `Timewrap.TimeSupervisor` is started with the `Timewrap.Application`\nand implicitly starts the default timer `:default_timer`. This\none is used whenever you call Timewrap-functions without a \ntimer given as the first argument.\n\n### Examples:\n\nThe best way to figure out how you can use this library is by having a look at \nthis [Test suite](https://github.com/iboard/hexpack-examples/blob/master/test/hexpack_examples_test.exs).\n\n\n    use Timewrap # imports some handy Timewrap-functions.\n\n#### With default Timer\n\n    Timewrap.freeze_timer()\n    item1 = %{ time: current_time() }\n    :timer.sleep(1000)\n    item2 = %{ time: current_time() }\n    assert item1.time == item2.time\n\n\n#### Transactions with a given and frozen time\n\n    with_frozen_timer(~N[1964-08-31 06:00:00Z], fn -\u003e\n      ... do something while `current_time` will \n      always return the given timestamp within this\n      block...\n    end )\n\n#### Start several independent timers\n\n    {:ok, today} = new_timer(:today)\n    {:ok, next_week} = new_timer(:next_week)\n    freeze_time(:today, ~N[2019-02-11 09:00:00])\n    freeze_time(:next_week, ~N[2019-02-18 09:00:00])\n    ... do something ...\n    unfreeze_time(:today)\n    unfreeze_time(:next_week)\n\n\n## Installation\n\nFrom [available Hex package](https://hex.pm/docs/publish), the package can be installed\nby adding `timewrap` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:timewrap, \"~\u003e 0.1\"}\n  ]\nend\n```\n \n### Configuration\n\n  `config/config.exs`\n\n      config :timewrap,\n        timer: :default,\n        unit: :second,\n        calendar: Calendar.ISO,\n        representation: :unix\n\n\n  `lib/your_app/application.ex`\n\n      use Application\n\n      @impl true\n      def start(_type, _args) do\n        # List all child processes to be supervised\n        children = [\n          # Starts a worker by calling: Timewrap.Worker.start_link(arg)\n          {Timewrap.TimeSupervisor, strategy: :one_for_one, name: Timewrap.TimeSupervisor} #\u003c---ADD THIS\n        ]\n\n        # See https://hexdocs.pm/elixir/Supervisor.html\n        # for other strategies and supported options\n        opts = [strategy: :one_for_one, name: Timewrap.Supervisor]\n        Supervisor.start_link(children, opts)\n      end\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/timewrap](https://hexdocs.pm/timewrap).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Ftimewrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiboard%2Ftimewrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Ftimewrap/lists"}