Namespace
Runtime\PS\Time
Package time exposes Go's time values to PHP without wrapping their method sets.
Description
Package time exposes Go's time values to PHP without wrapping their method sets. Register names the constructors and package functions explicitly; methods such as Time.Format, Time.Add, Duration.Minutes and Location.String reach a script through the runtime's normal Go-value method dispatch.
Two consequences of dispatching to Go's own methods are worth stating, since no wrapper is there to soften them:
- A duration argument is nanoseconds when written as an integer and
$t->add(86400) advances by 86.4 microseconds. The runtime coerces a
string to a time.Duration and $t->add("24h") is the spelling that means
what a PHP author reading time()+86400 expects.- A method Go declares with two or more results returns a PHP list, read with
list($year, $week) = $t->iso_week(). The short [$a, $b] = spelling does
not parse in this runtime.
- Package
stdlib/ps/timegodoc
Classes
Functions
A call writes the bare name or the name under this area:
\Runtime\PS\Time\date().