This circuit assumes that a pulse produced by S1 has a constant duration determined by R1 and C1.