It's been a while since I've looked at the code, but fairly sure this just reads the time of day value from the game, then converts it into a 24 hour format. So in theory, should be 100% accurate to the day/night cycle.
It also does the same reading the "Time played" ticks, converting that to a H:mm:ss format.