Universal - Device Time - Monitor (Pro)
Using the current date and time is essential for many applications. However, relying on the clock of the user's device creates trust issues, as users can manipulate it for various purposes such as extending trial periods or gaining advantages in games. AntiCheat has introduced a way to counteract such time manipulation.
Monitor
To monitor the device time, AntiCheat has introduced the 'DeviceTimeMonitor', which can be found in the 'GUPS.AntiCheat.Monitor.Time' namespace. The monitor tracks the device time and notifies observers of time deviations (a different date and time than expected) using the 'DeviceTimeStatus' that may be caused by a cheater.
Monitor Status
The monitor validates possible device time deviations every time the game gets resumed (continued or focused). After every validation, observers are notified with the 'DeviceTimeStatus'. This status has one property:
- Deviation: Represents the deviation of device time, indicating any time-related manipulations.
The 'Deviation' property can have the following values:
- None: No time deviation.
- Stopped: Indicates that time has stopped.
- SlowedDown: Indicates that time is slowing down.
- SpeedUp: Indicates that time is speeding up.
Supported Platforms
The monitor is available on all platforms.
Requirements
There are no requirements.
How To Use
The usage is quite simple: attach the 'DeviceTimeMonitor' to a child GameObject of the 'AntiCheat-Monitor' and set up the 'DeviceTimeCheatingDetector'.
Add Monitor Component
Add the 'DeviceTimeMonitor' MonoBehavior from the 'GUPS.AntiCheat.Monitor.Time' namespace to your 'AntiCheat-Monitor' GameObject, or better, to a child GameObject.

Add the 'DeviceTimeMonitor' as a Component.
The device time is validated each time the application is resumed by unpausing or focusing. During validation, the actual device time is compared with the time that has elapsed between suspending and resuming. As there may be delays due to the reallocation of memory and the resumption of threads in the operating system, a tolerance value is used to check whether there is a real deviation. This can be freely assigned by you in the monitor inspector view.
Every time a validation is done, a 'DeviceTimeStatus' is sent to observers (usually detectors next to the monitor) describing whether the application was stopped, slowed down, or sped up.
Detect Device Time Tampering
To react to the sent status and thus validate the calculated time deviations, you need a detector. To do this, use the 'DeviceTimeCheatingDetector', a detector designed to analyse the status sent by the 'DeviceTimeMonitor' and validate it for cheating.