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"); }
/** * 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'); }