I have developed and solved the constant-Q model for the attenuation of P- and S-waves in the time domain using a new modeling algorithm based on fractional derivatives. The model requires time derivatives of order applied to the strain components, where and , with Q the P-wave or S-wave quality factor. The derivatives are computed with the Grünwald-Letnikov and central-difference fractional approximations, which are extensions of the standard finite-difference operators for derivatives of integer order. The modeling uses the Fourier method to compute the spatial derivatives, and therefore can handle complex geometries and general material-property variability. I verified the results by comparison with the 2D analytical solution obtained for wave propagation in homogeneous Pierre Shale. Moreover, the modeling algorithm was used to compute synthetic seismograms in heterogeneous media corresponding to a crosswell seismic experiment.