Exemple #1
0
 /**
  * Is this time zone equivalent to another
  *
  * Tests to see if this time zone is equivalent to a given time zone object.
  * Equivalence in this context consists in the two time zones having:
  *
  *  an equal offset from UTC in both standard and Summer time (if
  *   the time zones observe Summer time)
  *  the same Summer time start and end rules, that is, the two time zones
  *   must switch from standard time to Summer time, and vice versa, on the
  *   same day and at the same time
  *
  * @param object $pm_tz the Date_TimeZone object to test, or a valid time
  *                       zone ID
  *
  * @return   bool       true if this time zone is equivalent to the supplied
  *                       time zone
  * @access   public
  */
 function isEquivalent($pm_tz)
 {
     if (is_a($pm_tz, "Date_TimeZone")) {
         if ($pm_tz->getID() == $this->id) {
             return true;
         }
     } else {
         if (!Date_TimeZone::isValidID($pm_tz)) {
             return PEAR::raiseError("Invalid time zone ID '{$pm_tz}'", DATE_ERROR_INVALIDTIMEZONE);
         }
         if ($pm_tz == $this->id) {
             return true;
         }
         $pm_tz = new Date_TimeZone($pm_tz);
     }
     if ($this->getRawOffset() == $pm_tz->getRawOffset() && $this->hasDaylightTime() == $pm_tz->hasDaylightTime() && $this->getDSTSavings() == $pm_tz->getDSTSavings() && $this->getSummerTimeStartMonth() == $pm_tz->getSummerTimeStartMonth() && $this->getSummerTimeStartDay() == $pm_tz->getSummerTimeStartDay() && $this->getSummerTimeStartTime() == $pm_tz->getSummerTimeStartTime() && $this->getSummerTimeEndMonth() == $pm_tz->getSummerTimeEndMonth() && $this->getSummerTimeEndDay() == $pm_tz->getSummerTimeEndDay() && $this->getSummerTimeEndTime() == $pm_tz->getSummerTimeEndTime()) {
         return true;
     } else {
         return false;
     }
 }