ative time spans).
*
* @param object Date_Span $time Time span to subtract.
*
* @access public
*/
function subtract($time)
{
$sub = $this->toSeconds() - $time->toSeconds();
if ($sub < 0) {
$this->setFromSeconds(0);
} else {
$this->setFromSeconds($sub);
}
}
// }}}
// {{{ equal()
/**
* Tells if time span is equal to $time.
*
* @param object Date_Span $time Time span to compare to.
*
* @return bool True if the time spans are equal.
*
* @access public
*/
function equal($time)
{
return $this->toSeconds() == $time->toSeconds();
}
// }}}
// {{{ greaterEqual()
/**
* Tells if this time span is greater or equal than $time.
*
* @param object Date_Span $time Time span to compare to.
*
* @return bool True if this time span is greater or equal than $time.
*
* @access public
*/
function greaterEqual($time)
{
return $this->toSeconds() >= $time->toSeconds();
}
// }}}
// {{{ lowerEqual()
/**
* Tells if this time span is lower or equal than $time.
*
* @param object Date_Span $time Time span to compare to.
*
* @return bool True if this time span is lower or equal than $time.
*
* @access public
*/
function lowerEqual($time)
{
return $this->toSeconds() <= $time->toSeconds();
}
// }}}
// {{{ greater()
/**
* Tells if this time span is greater than $time.
*
* @param object Date_Span $time Time span to compare to.
*
* @return bool True if this time span is greater than $time.
*
* @access public
*/
function greater($time)
{
return $this->toSeconds() > $time->toSeconds();
}
// }}}
// {{{ lower()
/**
* Tells if this time span is lower than $time.
*
* @param object Date_Span $time Time span to compare to.
*
* @return bool True if this time span is lower than $time.
*
* @access public
*/
function lower($time)
{
return $this->toSeconds() < $time->toSeconds();
}
// }}}
// {{{ compare()
/**
* Compares two time spans.
*
* Compares two time spans. Suitable for use in sorting functions.
*
* @param object Date_Span $time1 The first time span.
* @param object Date_Span $time2 The second time span.
*
* @return int 0 if the time spans are equal, -1 if time1 is lower
* than time2, 1 if time1 is greater than time2.
*
* @static
* @access public
*/
function compare($time1, $time2)
{
if ($time1->equal($time2)) {
return 0;
} elseif ($time1->lower($time2)) {
return -1;
} else {
return 1;
}
}
// }}}
// {{{ isEmpty()
/**
* Tells if the time span is empty (zero length).
*
* @return bool True is it's empty.
*/
function isEmpty()
{
return !$this->day && !$this->hour && !$this->minute && !$this->second;
}
// }}}
// {{{ setDefaultInputFormat()
/**
* Set the default input format.
*
* @param mixed $format New default input format.
*
* @return mixed Previous default input format.
*
* @static
*/
function setDefaultInputFormat($format)
{
$old = $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
$GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = $format;
return $old;
}
// }}}
// {{{ getDefaultInputFormat()
/**
* Get the default input format.
*
* @return mixed Default input format.
*
* @static
*/
function getDefaultInputFormat()
{
return $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
}
// }}}
// {{{ setDefaultFormat()
/**
* Set the default format.
*
* @param mixed $format New default format.
*
* @return mixed Previous default format.
*
* @static
*/
function setDefaultFormat($format)
{
$old = $GLOBALS['_DATE_SPAN_FORMAT'];
$GLOBALS['_DATE_SPAN_FORMAT'] = $format;
return $old;
}
// }}}
// {{{ getDefaultFormat()
/**
* Get the default format.
*
* @return mixed Default format.
*
* @static
*/
function getDefaultFormat()
{
return $GLOBALS['_DATE_SPAN_FORMAT'];
}
// }}}
// {{{ __clone()
/**
* Returns a copy of the object (workarround for PHP5 forward compatibility).
*
* @return object Date_Span Copy of the object.
*/
function __clone() {
$c = get_class($this);
$s = new $c;
$s->day = $this->day;
$s->hour = $this->hour;
$s->minute = $this->minute;
$s->second = $this->second;
return $s;
}
// }}}
}
// }}}
/*
* Local variables:
* mode: php
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?> n-line/kanji-colorati.html">Kanji
colorati
Símbolos Kanji
oro
¿Cómo funciona y funciona Reiki?
¿Quién puede venir y hacer el Reiki?
¿Cuál es la historia de Reiki?
Vivir Reiki
El aprendizaje de Reiki
La activación a distancia son eficaces?
Reiki, Preguntas y Respuestas
Reiki Enlaces de Recursos de Internet
Introducción a Reiki Slide Show!
Aprenda a decir que los Principios de Reiki en japonés
|
|
El Goka:
Sólo por hoy (Kyo Dake
* @author Pierre-Alain Joye |