Java Sleep sleepNanos(long nanoseconds)

Here you can find the source of sleepNanos(long nanoseconds)

Description

sleep Nanos

License

Open Source License

Declaration

public static void sleepNanos(long nanoseconds) 

Method Source Code

//package com.java2s;
/*/*from  w  w w  . jav a2s.  c o m*/
 Sketchy
 Copyright (C) 2015 Matthew Havlovick
 http://www.quickdrawbot.com

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

 Contact Info:

 Matt Havlovick
 QuickDraw
 470 I St
 Washougal, WA 98671

 matt@quickdrawbot.com
 http://www.quickdrawbot.com

 This General Public License does not permit incorporating your program into
 proprietary programs.  If your program is a subroutine library, you may
 consider it more useful to permit linking proprietary applications with the
 library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.
 */

public class Main {
    public static void sleepNanos(long nanoseconds) {
        long startTime = System.nanoTime();
        long endTime = startTime + nanoseconds;
        while (endTime >= System.nanoTime()) {
        }
    }
}

Related

  1. sleepMilliseconds(long ms)
  2. sleepMilliseconds(long ms)
  3. sleepMs(final int millis)
  4. sleepMSInChunks(long ms)
  5. sleepNanos(final long nanoDuration)
  6. sleepNoException(int ms)
  7. sleepNoShit(long nanos)
  8. sleepNotException(long millis)
  9. sleepNoThrow(long timeoutMs)