• Hello
Search Results for

    Show / Hide Table of Contents

    Protected Device Time (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.

    How to use

    AntiCheat supports a protected Coordinated Universal Time (UTC) DateTime, which calculates the current DateTime based on a reference value. This can be either the local time of the computer or a time from the Internet.

    
    // Instead of using DateTime.UtcNow, use the UtcNow from GUPS.AntiCheat.Protected.Time.ProtectedTime.
    public static class ProtectedTime
    {
        // The protected Coordinated Universal Time (UTC) DateTime (Read Only). The calculated UTC time, which may differ from the original DateTime.UtcNow 
        // because it is calculated to be as secure and trustworthy as possible.
        public static DateTime UtcNow { get; }
    }
    

    To counteract such manipulation, AntiCheat's Device Time Monitor and Detector are invaluable. They warn you if an attempt is made to change the date and time, and ensure that users cannot exploit such changes to gain undeserved advantages.

    Drag and drop the prefab onto the AntiCheat monitor in your scene.

    Custom Observer

    If you would like to write a custom listener for the detector, you can attach an observer:

    
    // Get the detector from the AntiCheat monitor.
    var detector = AntiCheatMonitor.Instance
          .GetDetector<DeviceTimeCheatingDetector>();
    
    // Subscribe as observer and get notified on cheating.
    detector.Subscribe(myObserver);
    
    In This Article
    Back to top GuardingPearSoftware documentation