QuackDB.NanosecondTime (quackdb v0.4.0)

Copy Markdown View Source

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.

Summary

Functions

Builds a TIME_NS value from an Elixir Time.

Builds a TIME_NS value from nanoseconds since midnight.

Returns the stored nanoseconds since midnight.

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

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

Types

t()

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

Functions

from_time(time)

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

Builds a TIME_NS value from an Elixir Time.

new(nanoseconds)

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

Builds a TIME_NS value from nanoseconds since midnight.

to_integer(nanosecond_time)

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

Returns the stored nanoseconds since midnight.

to_time(nanosecond_time)

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

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

valid?(nanosecond_time)

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

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