This will depend a lot on what you want to acomplish and the type of game you have.
You would have a 'game world' time that advances based on the cpu clock. Generally at a much faster pace so it can be seen. And you will need to take into account pausing, alt-tabbing and so on. You can also advance it manually such as when the player sleeps, uses some kind of fast travel system (a less simple one would be based on the distance travelled) or from mission to mission. More complex game time keeping systems might keep a record of the date and potentially even have their own calendar systems (Like the Elder Scrolls series). This could influence weather and so on.
You need to adjust your visuals based on the game time. This normally involves lighting and the sky. For a simple system, outside will normally have a light that represents the sun. You would need to adjust the brightness/color based on the time of the day and set it to a much darker color at night. And the sky texture itself will need to switch between day, night and dawn/dusk textures (preferably with some kind of smooth fade).
More advanced visual systems will track a path for the sun and moon across the sky. A simpler system many just put them at polar opposites to each other and have them go directly overhead, east to west.
In reality both bodies have their own paths. The moon can be up during the day at the same time the sun is. The moon has cycles. And both will often not be directly over head but on an arc the angle of which changes depending on the time of the year. The stars them selves will change slightly too.
Skyrim was even more advanced and had 3 moons. The original Theif games actually had star charts rather than just using a texture.
You will also want to use the suns position for shadows is you have realtime ones.