We generalize a method for determination of time scales of nonstationary diffusion in a one-dimensional medium. The time of relaxation to a stationary non-equilibrium density of substance in a system with a source, a sink, and an arbitrary potential profile are obtained and studied in detail. A few specific examples are considered.