Java Milliseconds elapsedMillis(long t0nanos, long t1nanos)

Here you can find the source of elapsedMillis(long t0nanos, long t1nanos)

Description

Get the elapsed milliseconds between two nano times

License

Apache License

Declaration

public static long elapsedMillis(long t0nanos, long t1nanos) 

Method Source Code

//package com.java2s;
/*/*from  w  ww .  j av  a2s  .  com*/
 * Copyright ?2012 Jawfish Games Inc
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

public class Main {
    /**
     * Get the elapsed milliseconds between two nano times
     */
    public static long elapsedMillis(long t0nanos, long t1nanos) {
        return (t1nanos - t0nanos) / 1000000;
    }

    /**
     * Get the elapsed milliseconds since the given nano time.
     */
    public static long elapsedMillis(long t0) {
        return elapsedMillis(t0, t0());
    }

    /**
     * Get the current time in nanos
     */
    public static long t0() {
        return System.nanoTime();
    }
}

Related

  1. diffMillisec(String lhs, String rhs)
  2. diffTimeInMillis(long start, long end)
  3. durationInMillis(long startNano)
  4. elapsedMillis(long milliseconds)
  5. elapsedMillis(long startTime)
  6. ensureSleepMillis(long millis)
  7. expensiveMethodTakingMillis(final int millis)
  8. filetimeToMillis(long filetime)
  9. formatDateMillis(long millis)