public function testFloatValues() { $time = new Time(1.5); $this->assertEquals(5400, $time->getSeconds()); $this->assertEquals('01:30:00', $time->format()); $time->addHours(0.5); $this->assertEquals('02:00:00', $time->format()); $time->setHours(2.75); $this->assertEquals('02:45:00', $time->format()); $time = new Time(0.5, 0.75, 0); $this->assertEquals('00:30:45', $time->format()); }
/** * Get a new instance of WallaceMaxters\Timer\Time of diff with another Time * * @param Time $time time for comparation * @param boolean $absolute * @return \WallaceMaxters\Timer\Time * */ public function diff(Time $time, $absolute = true) { $diff = $this->getSeconds() - $time->getSeconds(); return new self(0, 0, $absolute ? abs($diff) : $diff); }