Class ShadowSystemClock

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static boolean networkTimeAvailable  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void advanceBy​(java.time.Duration duration)
      A convenience method for advancing the clock via SystemClock.setCurrentTimeMillis(long)
      protected static java.lang.Object currentGnssTimeClock()  
      static long currentTimeMillis()
      Implements System.currentTimeMillis() through ShadowWrangler.
      static long nanoTime()
      Deprecated.
      Don't call this method directly; instead, use System.nanoTime().
      static void reset()  
      static void setGnssTimeAvailable​(boolean available)
      Sets whether gnss location based time is available.
      static void setNanoTime​(long nanoTime)
      Sets the value for System.nanoTime().
      static void setNetworkTimeAvailable​(boolean available)
      Sets whether network time is available.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • networkTimeAvailable

        protected static boolean networkTimeAvailable
    • Constructor Detail

      • ShadowSystemClock

        public ShadowSystemClock()
    • Method Detail

      • currentTimeMillis

        public static long currentTimeMillis()
        Implements System.currentTimeMillis() through ShadowWrangler.
        Returns:
        Current time in millis.
      • nanoTime

        @Deprecated
        public static long nanoTime()
        Deprecated.
        Don't call this method directly; instead, use System.nanoTime().
        Implements System.nanoTime().
        Returns:
        Current time with nanos.
      • setNanoTime

        public static void setNanoTime​(long nanoTime)
        Sets the value for System.nanoTime().

        May only be used for LooperMode.Mode.LEGACY. For LooperMode.Mode.PAUSED, {@param nanoTime} is calculated based on SystemClock.uptimeMillis() and can't be set explicitly.

      • setNetworkTimeAvailable

        public static void setNetworkTimeAvailable​(boolean available)
        Sets whether network time is available.
      • advanceBy

        public static void advanceBy​(java.time.Duration duration)
        A convenience method for advancing the clock via SystemClock.setCurrentTimeMillis(long)
        Parameters:
        duration - The interval by which to advance.
      • currentGnssTimeClock

        @Implementation(minSdk=29)
        protected static java.lang.Object currentGnssTimeClock()
      • setGnssTimeAvailable

        public static void setGnssTimeAvailable​(boolean available)
        Sets whether gnss location based time is available.
      • reset

        public static void reset()