Ejemplo n.º 1
0
 /**
  * Subtracts a time span to the date
  *
  * Subtracts a time span to the date
  *
  * @access public
  * @param
  *        	object Span $span the time span to subtract
  */
 function subtractSpan($span)
 {
     if (!is_a($span, 'TYPO3\\CMS\\Cal\\Model\\Pear\\Date\\Span')) {
         return;
     }
     if ($span->isEmpty()) {
         return;
     }
     $this->second -= $span->second;
     if ($this->second < 0) {
         $this->minute--;
         $this->second += 60;
     }
     $this->minute -= $span->minute;
     if ($this->minute < 0) {
         $this->hour--;
         if ($this->hour < 0) {
             list($this->year, $this->month, $this->day) = sscanf(Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s");
             $this->hour += 24;
         }
         $this->minute += 60;
     }
     $this->hour -= $span->hour;
     if ($this->hour < 0) {
         list($this->year, $this->month, $this->day) = sscanf(Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s");
         $this->hour += 24;
     }
     $d = Calc::dateToDays($this->day, $this->month, $this->year);
     $d -= $span->day;
     list($this->year, $this->month, $this->day) = sscanf(Calc::daysToDate($d), "%04s%02s%02s");
     $this->year = intval($this->year);
     $this->month = intval($this->month);
     $this->day = intval($this->day);
 }