From pointwise to local regularity for solutions of Hamilton–Jacobi equations