added more time functions and updated alarm thread