We present a protocol for calculation of K-edge x-ray absorption spectra using time-dependent Kohn-Sham (TDKS) calculations, also known as "real-time" time-dependent density functional theory (TDDFT). In principle, the entire absorption spectrum (at all wavelengths) can be computed via Fourier transform of the time-dependent dipole moment function, following a perturbation of the ground-state density and propagation of time-dependent Kohn-Sham molecular orbitals. In practice, very short time steps are required to obtain an accurate spectrum, which increases the cost, but the use of Pade approximants significantly reduces the length of time propagation that is required. Spectra that are well converged with respect to the corresponding linear-response (LR-)TDDFT result can be obtained with < 10 fs of propagation time. Use of complex absorbing potentials helps to remove artifacts at high energies that otherwise result from the use of a finite atom-centered Gaussian basis set. Benchmark results, comparing TDKS to LR-TDDFT, are presented for several small molecules at the carbon and oxygen K-edges, demonstrating good agreement with experiment without the need for specialized basis sets. Whereas LR-TDDFT is a reasonable approach to obtain the near-edge structure, that approach requires hundreds of states and quickly becomes cost prohibitive for large systems, even when the core\slash valence separation approximation is used to remove most of the occupied states from the excitation manifold. We demonstrate the cost-effective TDKS approach by application to a copper dithiolene complex, where binding of a ligand is detectable via shifts in the sulfur K-edge.