Control PWM motor running time with millis

So moving it up in the enclosed loop where i decide the pump to run would be more suitable?