Riemann-Hilbert approach to multi-time processes: The Airy and the Pearcey cases