Improved time funcion in Html class