Periodic solutions of differential equations with a general piecewise constant argument and applications