added function to update time