An accurate numerical method for solving the generalized time-fractional diffusion equation