Work out how long the player was away when the phone's clock cannot be trusted
Crafting jobs finish while the app is closed, so the game compares the clock now with the clock at the last save. But players change time zones, phones fix their clock overnight, and some players set it forward on purpose. This entry gives away-time that is never negative, uses the server when it can, and stops the clock from being used both ways.
Why this works
A phone's clock belongs to the player, so it can be wrong or changed on purpose, while a clock you keep yourself cannot. Trusting the outside source first, then the device, and treating a backward jump as zero, means no one gains free time by fiddling with settings.
When not to use it
If the game is purely single-player and nothing in it costs real money or competes with others, do not bother; a plain device clock is enough and the extra checks only add bugs. Be gentle with honest players instead.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 17 lines of example code with 6 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Work out how long the player was away when the phone's clock cannot be trusted" (read_entry mobile-clock-jump-away-time) 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