• Hello
Search Results for

    Show / Hide Table of Contents

    Protected Device Time (Pro)

    Many games use the device clock for trials, daily rewards, or timers. The player can change that clock.

    Walkthrough: Protecting against device clock cheating.

    How to use

    ProtectedTime.UtcNow is a UTC time built from a reference. That reference can be the device clock 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; }
    }
    

    The device time monitor and detector warn you when the date or time was moved. Use ProtectedTime.UtcNow for the rewards and timers that must stay fair.

    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