$starttime = new \DateTime();
sleep(5);
$currenttime = new \DateTime();
$timeNotOver = $currenttime->sub(new DateInterval($starttime)); // тут ошибка
<?php
$start = microtime(TRUE);
sleep(3);
$diff = microtime(TRUE) - $start;
printf('Execution time: %s s', $diff);