  A search for time-dependent violation of the charge-parity symmetry in $D^0
\to K^+ K^-$ and $D^0 \to \pi^+ \pi^-$ decays is performed at the LHCb
experiment using proton-proton collision data recorded from 2015 to 2018 at a
centre-of-mass energy of 13 TeV, corresponding to an integrated luminosity of 6
fb$^{-1}$. The $D^0$ meson is required to originate from a $D^*(2010)^+ \to D^0
\pi^+$ decay, such that its flavour at production is identified by the charge
of the accompanying pion. The slope of the time-dependent asymmetry of the
decay rates of $D^0$ and $\bar{D}^0$ mesons into the final states under
consideration is measured to be $\Delta Y_{K^+ K^-} = (-2.3 \pm 1.5 \pm 0.3)
\times 10^{-4}$, $\Delta Y_{\pi^+ \pi^-} = (-4.0 \pm 2.8 \pm 0.4)\times
10^{-4}$, where the first uncertainties are statistical and the second are
systematic. These results are compatible with the conservation of the
charge-parity symmetry at the level of 2 standard deviations and improve the
precision by nearly a factor of two.
