Protected Device Time (Pro)
Many games use the clock of the device for trials, daily rewards, or timers. The player can change that clock in the system settings. ProtectedTime.UtcNow gives you a date and time that does not simply trust the device.
Protected device time needs the Pro version.
Walkthrough: Protecting against device clock cheating.
How to use
Replace DateTime.UtcNow with ProtectedTime.UtcNow. It returns the time in UTC, the world time without time zones.
Before:
DateTime now = DateTime.UtcNow;
After:
using GUPS.AntiCheat.Protected.Time;
DateTime now = ProtectedTime.UtcNow;
Use it for the rewards and timers that must stay fair.
Do you need to add the detector?
ProtectedTime.UtcNow needs the DeviceTimeCheatingDetector and its two device time monitors. The monitors watch the device clock. The detector decides if it was moved and keeps the protected time.
Most of the time you have nothing to do. The predefined Anti-Cheat-Monitor prefab already includes them.
If you use your own monitor prefab, drag the Device Time Cheating Detector prefab onto the monitor in your prefab so it becomes a child. It holds the detector and both monitors together.

The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.
Settings: Device time monitors and Device time detector.
Good to know
- With Use Internet Time on, the protected time comes from a server. That is the default and the safest choice.
- The first read from the server takes a moment after the game starts. Until it works,
ProtectedTime.UtcNowuses the device clock. - If the device is offline, the last trusted time is kept and counted on from there.
For a reward that must only use the server time, wait until the detector says it is there:
var detector = AntiCheatMonitor.Instance.GetDetector<DeviceTimeCheatingDetector>();
if (detector != null && detector.IsServerTimeResolved)
{
// ProtectedTime.UtcNow now comes from the server.
}
React to a moved clock
Ask the detector in code:
var detector = AntiCheatMonitor.Instance.GetDetector<DeviceTimeCheatingDetector>();
if (detector != null && detector.PossibleCheatingDetected)
{
// The device clock was moved.
}
This flag turns off again when the clock looks normal.
More ways to react: Reacting to cheating.
Back to the Protected overview.