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 step up against 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 (different date time than expected) using the 'DeviceTimeStatus', that may be caused by a cheater.
Monitor Status
The monitor validates everytime the game gets resumed (continued or focused) for possible device time deviation. After every validation observers will be 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 setup 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 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 the suspending and the resuming. As there may be delays due to the reallocation of memory and the continuing 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.
Everytime a validation was done, a 'DeviceTimeStatus' is sent to observers (usually detectors next to the monitor) describing if the application was stopped, slowed down or speed up.
Detect Device Time Tampering
To react to the sent status and so validate the calculated time deviations, you need a detector. To do this, use the 'DeviceTimeCheatingDetector', a detector designed to analyse the status send by the 'DeviceTimeMonitor' and validate it for cheating.