Compares two points in time

@param TimePoint $timepoint The point in time to compare $this with.

@return int Returns -1, 0 or 1 if $this is less than, equal to or greater than $timepoint respectively.
355773
public function compare(TimePoint $timepoint)
    {
        $first = $this->date;
        $second = $this->timePointToDateTime($timepoint);
        if ($first < $second) {
            return -1;
        }
        if ($first > $second) {
            return 1;
        }
        return 0;
    }
1120234
public function compare(Position $position): int
    {
        if ($this->line === $position->line && $this->character === $position->character) {
            return 0;
        }

        if ($this->line !== $position->line) {
            return $this->line - $position->line;
        }

        return $this->character - $position->character;
    }
768491
public function compareTo(Duration $that) : int
    {
        $seconds = $this->seconds - $that->seconds;

        if ($seconds !== 0) {
            return $seconds > 0 ? 1 : -1;
        }

        $nanos = $this->nanos - $that->nanos;

        if ($nanos !== 0) {
            return $nanos > 0 ? 1 : -1;
        }

        return 0;
    }
552540
public static function getOffset($ts = 'now', $timezone = self::UTC, $target_timezone = self::UTC) {

		if (!self::isValidTimezone($timezone) || !self::isValidTimezone($target_timezone)) {
			return 0;
		}

		$dta = new DateTime(null, new DateTimeZone($timezone));
		$dtb = new DateTime(null, new DateTimeZone($target_timezone));

		if (is_int($ts)) {
			$dta->setTimestamp($ts);
			$dtb->setTimestamp($ts);
		} else {
			$dta->modify($ts);
			$dtb->modify($ts);
		}

		return $dtb->getOffset() - $dta->getOffset();
	}
572941
@Override
    public int compareTo(Delayed other) {
        if (this == other) {
            return 0;
        }
        long diff = getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS);
        return diff == 0 ? 0 : (diff < 0) ? -1 : 1;
    }
1241087
public static function timeDiffSeconds(DateTime $time1, DateTime $time2)
    {
        $interval = $time1->diff($time2);

        return self::totalSeconds($interval);
    }
1231037
public static function setTimeZone($timezone)
    {
        if (self::_validateTimezone($timezone)) {
            self::$timezone = $timezone;
            return true;
        }
        return false;
    }
886610
public function min(Time $dt = null)
        {
            $dt = ($dt === null) ? static::now($this->tz) : $dt;

            return $this->lt($dt) ? $this : $dt;
        }
60819
public function getTimeRemaining(string $address): int
    {
        return (int)$this->get(sprintf('%s/%s', Resources::TIME_REMAINING, $address))->seconds_remaining;
    }
720878
public function cmp($value)
	{
		$ts = sfDateTimeToolkit::getTS($value);
		
		if ($this->ts < $ts)
		{
			// less than
			return -1;
		}
		else if ($this->ts > $ts)
		{
			// greater than
			return 1;
		}
		
		// equal to
		return 0;
	}
820097
function milliseconds( $dp = null ){
	 	if( $this->is_running() ){
		 	$now = microtime( false );
		}
		else {
			$now = $this->stopped;
		}
		$started = self::parse_microtime( $this->started );
		$stopped = self::parse_microtime( $now );
		$ms = $stopped - $started;
		if( ! is_null($dp) ){
			$mult = pow( 10, $dp );
			$ms = round( $mult * $ms ) / $mult;
		}
		return $ms;
	 }
1364541
public function touch( $time = NULL ) : bool
    {
        if ( $time === NULL ){
            return touch( $this->path );
        }
        return touch( $this->path, $time );
    }
850493
function isEqualTo( &$time )
    {
        $t1 =& $this->Time;
        if ( $time instanceof eZTime )
            $t2 = $time->timeOfDay();
        else
            $t2 = ( $time % self::SECONDS_A_DAY );
        return $t1 == $t2;
    }
320377
public function speed(TrackPoint $trackPoint): float
    {
        $start = $this->dateTime();
        $end = $trackPoint->dateTime();
        $dateDiff = $start->diff($end);
        $secondsDifference = ($dateDiff->days * 86400) + ($dateDiff->h * 3600) + ($dateDiff->i * 60) + $dateDiff->s;

        if ($secondsDifference === 0) {
            return 0.0;
        }

        $distance = $this->distanceFromPoint($trackPoint);

        return ($distance / $secondsDifference) * 3.6;
    }
1011608
public function hit(Endpoint $endpoint, $count = 1)
    {
        $region = $endpoint->getRegion();
        
        $rateLimit = isset($this->limits[get_class($endpoint)]) ? $this->limits[get_class($endpoint)] : $endpoint->getLimit();
        
        $time = array_keys($rateLimit)[0];
        $limit = $rateLimit[$time];
        
        // Get the respective time limit for this region
        $item = $this->get($endpoint, $time);

        // No results found, create new count for the limit
        if (! $item->isHit()) {
            $item->set($count)->expiresAfter($time);
            $this->store->save($item);
            
            return true;
        }

        // Otherwise there is a count saved for region+method,
        // check if the request count can be performed.
        $currentCount = $item->get();
        if ($count + $currentCount > $limit) {
            throw new RateLimitReachedException(
                "Sending {$count} request".($count === 1) ? '' : 's'." is not allowed! ".
                "Rate limit for '{$endpoint->getName()}' ({$region->getName()}) reached. ".
                "Current count: {$currentCount}. Limit: {$limit}/{$time}s."
            );
        }

        // If it can, increase the current limit
        $item->set($currentCount + $count);
        $this->store->save($item);
        
        return true;
    }
676141
public static function minOf(LocalDateTime ...$times) : LocalDateTime
    {
        if (! $times) {
            throw new DateTimeException(__METHOD__ . ' does not accept less than 1 parameter.');
        }

        $min = LocalDateTime::max();

        foreach ($times as $time) {
            if ($time->isBefore($min)) {
                $min = $time;
            }
        }

        return $min;
    }
237882
public static function compareTiem($timeA, $timeB)
    {
        $a=strtotime($timeA);
        $b=strtotime($timeB);
        if ($a > $b) {
            return 1;
        } elseif ($a == $b) {
            return 0;
        } else {
            return -1;
        }
    }