コード例 #1
0
ファイル: File.class.php プロジェクト: Superbeest/Core
 /**
  * Sets the modified time of the file
  * @param \System\Calendar\Time The modified time
  * @return File The current instance
  */
 public final function setModifiedTime(\System\Calendar\Time $time)
 {
     touch($this->getAbsoluteFilename(), $time->toUNIX(), fileatime($this->fullPath));
     return $this;
 }
コード例 #2
0
ファイル: Time.class.php プロジェクト: Superbeest/Core
 /**
  * Compares two Times with eachother. When the given parameter is before
  * the current Time object, then we return \System\Math\Math::COMPARE_LESSTHAN,
  * if it equals we return \System\Math\Math::COMPARE_EQUAL, else \System\Math\Math::COMPARE_GREATERTHAN.
  * @param \System\Calendar\Time A Time object to compare with.
  * @return int An integer representing the equality.
  */
 public final function compare(\System\Calendar\Time $time)
 {
     if ($this->toUNIX() == $time->toUNIX()) {
         return \System\Math\Math::COMPARE_EQUAL;
     }
     return $this->toUNIX() > $time->toUNIX() ? \System\Math\Math::COMPARE_LESSTHAN : \System\Math\Math::COMPARE_GREATERTHAN;
 }
コード例 #3
0
ファイル: Calendar.class.php プロジェクト: Superbeest/Core
 /**
  * Returns the amount of days between two given times. The order of the Time objects is not relevant.
  * @param \System\Calendar\Time The first time
  * @param \System\Calendar\Time The second time
  * @return int The amount of days between the given Time objects
  */
 public static final function getAmountOfDaysBetweenTimes(\System\Calendar\Time $time1, \System\Calendar\Time $time2)
 {
     $diff = abs($time1->toUNIX() - $time2->toUNIX());
     return floor($diff / \System\Calendar\Time::SECONDS_IN_DAY);
 }