Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 45 for toNanos (0.09 seconds)

  1. okhttp/src/jvmTest/kotlin/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt

      @AfterEach fun tearDown() {
        backend.shutdown()
      }
    
      @Test fun test() {
        val t1 = System.nanoTime() / 1e6
    
        val delays = mutableListOf(TimeUnit.MILLISECONDS.toNanos(1000), -1L)
        queue.schedule("task", TimeUnit.MILLISECONDS.toNanos(750)) {
          log.put("runOnce delays.size=${delays.size}")
          return@schedule delays.removeAt(0)
        }
    
        assertThat(log.take()).isEqualTo("runOnce delays.size=2")
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 3.5K bytes
    - Click Count (0)
  2. android/guava-testlib/src/com/google/common/testing/FakeTicker.java

      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
      @CanIgnoreReturnValue
      public FakeTicker advance(long time, TimeUnit timeUnit) {
        return advance(timeUnit.toNanos(time));
      }
    
      /** Advances the ticker value by {@code nanoseconds}. */
      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
      @CanIgnoreReturnValue
      public FakeTicker advance(long nanoseconds) {
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Mon Apr 14 15:16:19 GMT 2025
    - 4.1K bytes
    - Click Count (0)
  3. guava-testlib/src/com/google/common/testing/FakeTicker.java

      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
      @CanIgnoreReturnValue
      public FakeTicker advance(long time, TimeUnit timeUnit) {
        return advance(timeUnit.toNanos(time));
      }
    
      /** Advances the ticker value by {@code nanoseconds}. */
      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
      @CanIgnoreReturnValue
      public FakeTicker advance(long nanoseconds) {
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Mon Apr 14 15:16:19 GMT 2025
    - 3.4K bytes
    - Click Count (0)
  4. android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java

      public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit) {
        boolean interrupted = false;
        try {
          long remainingNanos = unit.toNanos(timeout);
          long end = System.nanoTime() + remainingNanos;
    
          while (true) {
            try {
              // CountDownLatch treats negative timeouts just like zero.
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Jan 29 23:24:32 GMT 2026
    - 22.5K bytes
    - Click Count (0)
  5. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

        ): Builder =
          apply {
            throttleBytesPerPeriod = bytesPerPeriod
            throttlePeriodNanos = unit.toNanos(period)
          }
    
        public fun headersDelay(
          delay: Long,
          unit: TimeUnit,
        ): Builder =
          apply {
            headersDelayNanos = unit.toNanos(delay)
          }
    
        /**
         * Set the delayed time of the response body to [delay]. This applies to the response body
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 17.8K bytes
    - Click Count (0)
  6. android/guava-testlib/src/com/google/common/testing/GcFinalization.java

      public static void awaitDone(Future<?> future) {
        if (future.isDone()) {
          return;
        }
        long timeoutSeconds = timeoutSeconds();
        long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds);
        do {
          System.runFinalization();
          if (future.isDone()) {
            return;
          }
          System.gc();
          try {
            future.get(1L, SECONDS);
            return;
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Mar 12 20:19:19 GMT 2026
    - 12.3K bytes
    - Click Count (0)
  7. guava/src/com/google/common/collect/Internal.java

        // Using a try/catch seems lazy, but the catch block will rarely get invoked (except for
        // durations longer than approximately +/- 292 years).
        try {
          return duration.toNanos();
        } catch (ArithmeticException tooBig) {
          return duration.isNegative() ? Long.MIN_VALUE : Long.MAX_VALUE;
        }
      }
    
      private Internal() {}
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Tue Nov 04 17:24:58 GMT 2025
    - 1.7K bytes
    - Click Count (0)
  8. guava-testlib/src/com/google/common/testing/GcFinalization.java

      public static void awaitDone(Future<?> future) {
        if (future.isDone()) {
          return;
        }
        long timeoutSeconds = timeoutSeconds();
        long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds);
        do {
          System.runFinalization();
          if (future.isDone()) {
            return;
          }
          System.gc();
          try {
            future.get(1L, SECONDS);
            return;
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Mar 12 20:19:19 GMT 2026
    - 12.3K bytes
    - Click Count (0)
  9. android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java

        }
    
        @Override
        public boolean equals(@Nullable Object o) {
          if (o instanceof DurationSpec) {
            DurationSpec that = (DurationSpec) o;
            return unit.toNanos(duration) == that.unit.toNanos(that.duration);
          }
          return false;
        }
    
        @Override
        public String toString() {
          return MoreObjects.toStringHelper(this)
              .add("duration", duration)
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Wed Mar 18 18:06:14 GMT 2026
    - 7.5K bytes
    - Click Count (0)
  10. guava/src/com/google/common/base/Internal.java

        // Using a try/catch seems lazy, but the catch block will rarely get invoked (except for
        // durations longer than approximately +/- 292 years).
        try {
          return duration.toNanos();
        } catch (ArithmeticException tooBig) {
          return duration.isNegative() ? Long.MIN_VALUE : Long.MAX_VALUE;
        }
      }
    
      private Internal() {}
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Mon Apr 14 15:16:19 GMT 2025
    - 1.9K bytes
    - Click Count (0)
Back to Top