Beispiel #1
0
 public function testCanGetSeconds()
 {
     $this->assertEquals($this->testSeconds, $this->testTimeValue->getSeconds(), "Cannot get seconds");
     $testTimeValue = new TimeValue('12:00:00');
     $this->assertEquals(43200, $testTimeValue->getSeconds(), "Cannot get seconds");
     $testTimeValue = new TimeValue('23:59:59');
     $this->assertEquals(86399, $testTimeValue->getSeconds(), "Cannot get seconds");
     $testTimeValue = new TimeValue('12:00:00');
     $this->assertEquals(43200, $testTimeValue->getSeconds(), "Cannot get seconds");
 }
Beispiel #2
0
 /**
  * Subtract a TimeValue from $this and return a new object.
  *
  * @param TimeValue $time
  * @return TimeValue
  */
 public function sub(TimeValue $time)
 {
     $totalSeconds = $this->seconds - $time->getSeconds();
     return new TimeValue("{$totalSeconds}", 's');
 }