There are other implications of this behavior. For example, I have automatic lights based on brightness sensor. It looks like all automations are taking brightness value from the 9 hours past and think it’s middle of the night and turn on my lights when movement detected.
You are probably using a Raspberry device.
A Raspberry does not have an onboard Real Time Clock (RTC) and therefore the clock might be out of sync on restarts.
This can also happen on other computers if the RTC battery is dead.
The OS calls a time server (NTP) server on the internet and corrects the time then, but it might take long enough for your HA setup to have reacted on the wrong time.
If you are using a Raspberry device, then there is RTC modules available for it. The ones based on the DS3231 chip is considered extra good, because the drift when temperature is changing is taken into account in the design.
If you are not using a Raspberry device, then open up your server and see if you have a coin cell battery somewhere. Read the text on it and buy a new one of that type. Its typical something like CR2032 or the like.