#hex Working with Time in Elixir using 'timewrap'

Posted on Sep 21, 2025

Dealing with time in software development can be tricky. The timewrap hex package for Elixir provides a convenient way to work with time-related operations, especially in testing.

timewrap acts as a “Time-Wrapper” that allows you to access different time sources in Elixir and Erlang. One of its most powerful features is the ability to freeze and unfreeze timers. This is incredibly useful for writing deterministic tests for time-dependent code.

Instead of relying on the system clock, you can use timewrap to control the flow of time in your tests, making them more reliable and easier to reason about.

You can find more details and examples of how to use timewrap on its Hex.pm page.