refactor time.php, rewrite test case