Beispiel #1
0
     * The comparison is based on the time-line position of the instants.
     *
     * @param mixed $otherInstant object the other instant, null returns false
     * @return boolean true if the other instant is equal to this one
     */
    public function equals($otherInstant)
    {
        if ($this === $otherInstant) {
            return true;
        }
        if ($otherInstant instanceof Instant) {
            $other = $otherInstant;
            return $this->seconds == $other->seconds && $this->nanos == $other->nanos;
        }
        return false;
    }
    //-----------------------------------------------------------------------
    /**
     * A string representation of this instant using ISO-8601 representation.
     * <p>
     * The format used is the same as {@link DateTimeFormatter#ISO_INSTANT}.
     *
     * @return string an ISO-8601 representation of this instant, not null
     */
    public function __toString()
    {
        return DateTimeFormatter::ISO_INSTANT()->format($this);
    }
}
Instant::init();