added function to extrac time for max values