Keep the play time on the save screen honest when the laptop sleeps
A long adventure shows hours played next to each save, and a naive clock turns one night with the lid closed into eight extra hours. This entry shows how to count only real play and how to show the total so that long games do not wrap around.
Why this works
A clock measures the time that passed, but play time is only the time the player actually played. Adding up short slices and ignoring any slice that is far too long or runs backwards means sleep, background and clock changes simply add nothing.
When not to use it
Skip it when real elapsed time is the point, such as a farm that grows while you are away or a timed event that ends on a fixed date. There, use the wall clock and work out the gap when the player returns.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 19 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Keep the play time on the save screen honest when the laptop sleeps" (read_entry playtime-counter-after-sleep) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP