# `QuackDB.NanosecondTime`
[🔗](https://github.com/elixir-vibe/quackdb/blob/main/lib/quack_db/nanosecond_time.ex#L1)

DuckDB `TIME_NS` value stored as nanoseconds since midnight.

Elixir's `Time` type stores microseconds, so this struct preserves DuckDB's
nanosecond precision while still offering conversion to a truncated `Time`.

# `t`

```elixir
@type t() :: %QuackDB.NanosecondTime{nanoseconds: integer()}
```

# `from_time`

```elixir
@spec from_time(Time.t()) :: t()
```

Builds a `TIME_NS` value from an Elixir `Time`.

# `new`

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

Builds a `TIME_NS` value from nanoseconds since midnight.

# `to_integer`

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

Returns the stored nanoseconds since midnight.

# `to_time`

```elixir
@spec to_time(t()) :: Time.t()
```

Converts to an Elixir `Time`, truncating sub-microsecond precision.

# `valid?`

```elixir
@spec valid?(t()) :: boolean()
```

Returns true when the value is in DuckDB's time-of-day range.

---

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