write time and plot