예제 #1
0
     */
    public function isTimeBased()
    {
        return $this->compareTo(self::$DAYS) < 0;
    }
    //-----------------------------------------------------------------------
    public function isSupportedBy(Temporal $temporal)
    {
        return $temporal->isUnitSupported($this);
    }
    public function addTo(Temporal $temporal, $amount)
    {
        return $temporal->plus($amount, $this);
    }
    //-----------------------------------------------------------------------
    public function between(Temporal $temporal1Inclusive, Temporal $temporal2Exclusive)
    {
        return $temporal1Inclusive->until($temporal2Exclusive, $this);
    }
    //-----------------------------------------------------------------------
    public function __toString()
    {
        return $this->name;
    }
    private function compareTo(ChronoUnit $other)
    {
        return $this->duration->compareTo($other->duration);
    }
}
ChronoUnit::init();