Exemple #1
0
 /**
  * Compares this time to another time.
  * <p>
  * The comparison is based on the time-line position of the local times within a day.
  * It is "consistent with equals", as defined by {@link Comparable}.
  *
  * @param LocalTime $other the other time to compare to, not null
  * @return int the comparator value, negative if less, positive if greater
  * @throws NullPointerException if {@code other} is null
  */
 public function compareTo(LocalTime $other)
 {
     $cmp = Integer::compare($this->hour, $other->hour);
     if ($cmp == 0) {
         $cmp = Integer::compare($this->minute, $other->minute);
         if ($cmp == 0) {
             $cmp = Integer::compare($this->second, $other->second);
             if ($cmp == 0) {
                 $cmp = Integer::compare($this->nano, $other->nano);
             }
         }
     }
     return $cmp;
 }