# `Unit.Time`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/unit/time.ex#L1)

A duration, stored canonically in nanoseconds. Build with `ns/1`/`us/1`/`ms/1`/`s/1`,
read back with the matching `as_*` accessor. A `Time` is a distinct struct, so it
cannot be mixed with other dimensions (`Information`, `Bandwidth`). Arithmetic
(`+`, `-`) and comparison (`<`, `>`, `<=`, `>=`) come from `Unit.Operators`.

# `t`

```elixir
@opaque t()
```

# `as_ms`

```elixir
@spec as_ms(t()) :: integer()
```

# `as_ns`

```elixir
@spec as_ns(t()) :: integer()
```

# `as_s`

```elixir
@spec as_s(t()) :: integer()
```

# `as_us`

```elixir
@spec as_us(t()) :: integer()
```

# `ms`

```elixir
@spec ms(integer()) :: t()
```

# `ns`

```elixir
@spec ns(integer()) :: t()
```

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, t()} | {:error, {:bad_unit, String.t()}}
```

Parse a duration string like `"60s"`/`"100ms"`/`"1h"`. Suffixes: ns/us/ms/s/m/h.

# `parse!`

```elixir
@spec parse!(String.t()) :: t()
```

Like `parse/1` but raises `ArgumentError` on bad input.

# `s`

```elixir
@spec s(integer()) :: t()
```

# `us`

```elixir
@spec us(integer()) :: t()
```

# `zero`

```elixir
@spec zero() :: t()
```

The zero duration (additive identity).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
