Browse Source

Use System.currentTimeMillis()

master
Ben Kurtovic 12 years ago
parent
commit
361b560d36
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      src/Render.java

+ 2
- 3
src/Render.java View File

@@ -1,6 +1,5 @@
package edu.stuy.goldfish; package edu.stuy.goldfish;
import java.util.Date;
import java.awt.Canvas; import java.awt.Canvas;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@@ -99,7 +98,7 @@ public class Render extends Canvas implements Runnable {
} }
public void sleep() { public void sleep() {
long since = (new Date()).getTime() - _last_tick;
long since = System.currentTimeMillis() - _last_tick;
if (since < 1000 / max_fps) { if (since < 1000 / max_fps) {
try { try {
Thread.sleep(1000 / max_fps - since); Thread.sleep(1000 / max_fps - since);
@@ -108,7 +107,7 @@ public class Render extends Canvas implements Runnable {
return; return;
} }
} }
_last_tick = (new Date()).getTime();
_last_tick = System.currentTimeMillis();
} }
public void setGrid(Grid g) { public void setGrid(Grid g) {


Loading…
Cancel
Save