aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl/xblast/Time.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/xblast/Time.java')
-rw-r--r--src/ch/epfl/xblast/Time.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/Time.java b/src/ch/epfl/xblast/Time.java
index 7c84257..c53f1ef 100644
--- a/src/ch/epfl/xblast/Time.java
+++ b/src/ch/epfl/xblast/Time.java
@@ -28,4 +28,17 @@ public interface Time {
28 */ 28 */
29 int NS_PER_S = 1000 * US_PER_S; 29 int NS_PER_S = 1000 * US_PER_S;
30 30
31 /**
32 * Pauses the current thread for the given duration.
33 *
34 * @param ns the sleep duration (ns)
35 */
36 static void sleep(long ns) {
37 try {
38 Thread.sleep((long) (ns / 1E6), (int) (ns % 1E6));
39 } catch (InterruptedException e) {
40 Thread.currentThread().interrupt();
41 }
42 }
43
31} 44}