https://github.com/walkr/durex
Parse short time durations to their numerical value in milliseconds. e.g. "1s" -> 1000
https://github.com/walkr/durex
duration elixir millisecond
Last synced: about 1 year ago
JSON representation
Parse short time durations to their numerical value in milliseconds. e.g. "1s" -> 1000
- Host: GitHub
- URL: https://github.com/walkr/durex
- Owner: walkr
- License: mit
- Created: 2018-08-02T13:02:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-17T23:18:04.000Z (over 4 years ago)
- Last Synced: 2025-03-04T06:02:59.577Z (over 1 year ago)
- Topics: duration, elixir, millisecond
- Language: Elixir
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Durex
[Documentation](https://hexdocs.pm/durex)
A small Elixir library for parsing durations, such as `"1s"`, to its numerical millisecond value, e.g. `1_000`.
## Installation
```elixir
def deps do
[
{:durex, "~> 0.1.0"}
]
end
```
## Usage
```elixir
# Success
{:ok, 1_000} = Durex.ms("1s")
{:ok, 500} = Durex.ms("0.5s")
500 = Durex.ms!("0.5s")
# Error
:error = Durex.ms("bla")
```
MIT License