Add function get_closest_time for finding the closest time for a given layer and time input.