The time-marching method of fundamental solutions for wave equations