bitwalker / bitwalker/timex

Provide the ability to control the source of time

Open
#584 1 comment 3 reactions 0 assignees View on GitHub
feature/enhancement
Dominant language
Elixir
Stars
1.8k
Forks
407
PR merge metrics
No merged PRs in 30d

Description

I had been looking at this library as a library I could use to control the "current time" by controlling a "managed clock": https://hexdocs.pm/time_machinex/readme.html#content

However, this library is not compatible with TimeX due to the overlap in domain.

* Be able to use the clock as usual when in `:dev` or `:prod`, for example, but when in `:test` the clock would behave differently (or have a flag to the `now()` function that uses the managed clock)
* Be able to freeze the clock and restart it
* Be able to set any arbitrary time in any TZ on the clock
* Be able to speed up or slow down time by a factor, such as 1 second per minute (slow by 60x) or 1 hour per second (speed up by 3600x)
* Be able to provide a function to the managed clock that transforms the real-time clock into another time (maybe it would be "good enough" to provide a way to pass a function into the current `now()` function and then use that function to transform the clock, then I can just put transformations into the code where I want it and we wouldn't need to have other methods to control a managed clock?)

Thanks so much for the nice library and for considering this proposal.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.