Class ClockSkew


  • @ThreadSafe
    public final class ClockSkew
    extends Object
    Utility methods for checking and reacting to the current client-side clock being different from the service-side clock.
    • Method Detail

      • isClockSkewed

        public static boolean isClockSkewed​(Instant clientTime,
                                            Instant serverTime)
        Determine whether the request-level client time was sufficiently skewed from the server time as to possibly cause a clock skew error.
      • getClockSkew

        public static Duration getClockSkew​(Instant clientTime,
                                            Instant serverTime)
        Calculate the time skew between a client and server date. This value has the same semantics of HttpClientDependencies.timeOffset(). Positive values imply the client clock is "fast" and negative values imply the client clock is "slow".
      • getServerTime

        public static Optional<Instant> getServerTime​(SdkHttpResponse serviceResponse)
        Get the server time from the service response, or empty if the time could not be determined.