php-dextrin

DXNTime
in package
implements DXNValueInterface

FinalYes

DXN `time` (`@time "HH:MM:SS(.f{1,9})?"`) -- a bare time of day, ISO 8601, to the nanosecond (DXN.md §1.3; Jan, 2026-10-20). No conversion helper: PHP has no native "time of day" type to convert to/from without a synthetic, misleading date component.

Table of Contents

Interfaces

DXNValueInterface
Implemented by every `DXN*` wrapper class -- the PHP analog of the `dxnType` string tag used for kind dispatch in the JS port, and of `Dextrin.Value`'s closed type union in the Elixir original. Native PHP values (`null`, `bool`, `int`, `float`, `string`, and `array` for `map`/`array`) never implement this; {@see Equality::kindOf()} handles those directly.

Constants

DXN_TYPE  : mixed = 'time'
NANOS_PER_SECOND  : mixed = 1000000000

Properties

$hour  : int
$minute  : int
$nanosecond  : int
$second  : int

Methods

__construct()  : mixed
compareTo()  : int
A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.
dxnType()  : string
The DXN type name this value represents, e.g. "symbol", "uuid".
equals()  : bool
Structural equality, recursing into nested DXN values as needed.
fromNanosecondsSinceMidnight()  : self
The time `$nanos` after midnight -- what `.dxnb` holds (DXN.md §2.2).
nanosecondsSinceMidnight()  : int

Constants

DXN_TYPE

private mixed DXN_TYPE = 'time'

NANOS_PER_SECOND

private mixed NANOS_PER_SECOND = 1000000000

Properties

$minute read-only

public int $minute

$nanosecond read-only

public int $nanosecond

$second read-only

public int $second

Methods

__construct()

public __construct(int $hour, int $minute, int $second[, int $nanosecond = 0 ]) : mixed
Parameters
$hour : int
$minute : int
$second : int
$nanosecond : int = 0
Tags
throws
InvalidArgumentException

for a field out of its range.

compareTo()

A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.

public compareTo(mixed $other) : int
Parameters
$other : mixed
Return values
int

dxnType()

The DXN type name this value represents, e.g. "symbol", "uuid".

public dxnType() : string
Return values
string

equals()

Structural equality, recursing into nested DXN values as needed.

public equals(mixed $other) : bool
Parameters
$other : mixed
Return values
bool

fromNanosecondsSinceMidnight()

The time `$nanos` after midnight -- what `.dxnb` holds (DXN.md §2.2).

public static fromNanosecondsSinceMidnight(int $nanos) : self
Parameters
$nanos : int
Tags
throws
InvalidArgumentException

for a count outside one day.

Return values
self

nanosecondsSinceMidnight()

public nanosecondsSinceMidnight() : int
Return values
int —

this time's nanoseconds since midnight.

On this page

Search results