Beispiel #1
0
 /**
  * Returns the total elapsed time.
  *
  * This includes the times between previous start() and stop() calls if any,
  * as well as the time since the stopwatch was last started if it is running.
  *
  * @return Duration
  */
 public function getElapsedTime()
 {
     if ($this->startTime === null) {
         return $this->duration;
     }
     return $this->duration->plus(Duration::between($this->startTime, Instant::now()));
 }
Beispiel #2
0
 /**
  * Returns a Duration representing the time elapsed in this Interval.
  *
  * @return \Brick\DateTime\Duration
  */
 public function getDuration()
 {
     return Duration::between($this->start, $this->end);
 }