some tests
This commit is contained in:
parent
5cf177a346
commit
3ddf431c48
@ -128,20 +128,14 @@ public class Scheduler extends Thread {
|
|||||||
|
|
||||||
// this.cur_nano += (((double)diff_nano)/1000000.0)*this.acceleration;
|
// this.cur_nano += (((double)diff_nano)/1000000.0)*this.acceleration;
|
||||||
// return (long)(cur_nano/1000000.0);
|
// return (long)(cur_nano/1000000.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.current_nanos += (double) diff * (double) this.acceleration;
|
this.current_nanos += (double) diff * (double) this.acceleration;
|
||||||
|
|
||||||
// this.current_time_millis += ((double) diff) * this.acceleration;
|
// this.current_time_millis += ((double) diff) * this.acceleration;
|
||||||
|
|
||||||
this.current_time_millis = this.current_nanos / 1000000.0;
|
this.current_time_millis = this.current_nanos / 1000000.0;
|
||||||
|
|
||||||
return (long) this.current_time_millis;
|
return (long) this.current_time_millis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -175,10 +169,6 @@ public class Scheduler extends Thread {
|
|||||||
return (long) this.current_time_millis;
|
return (long) this.current_time_millis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public long currentTimeMillis() {
|
public long currentTimeMillis() {
|
||||||
// return (long)(cur_nano/1000000.0);
|
// return (long)(cur_nano/1000000.0);
|
||||||
return (long) this.current_time_millis;
|
return (long) this.current_time_millis;
|
||||||
@ -327,7 +317,6 @@ public class Scheduler extends Thread {
|
|||||||
long t = event_queue.firstKey();
|
long t = event_queue.firstKey();
|
||||||
long ct = currentTimeMillis1();
|
long ct = currentTimeMillis1();
|
||||||
|
|
||||||
|
|
||||||
// ct = t;
|
// ct = t;
|
||||||
if (t > ct) {
|
if (t > ct) {
|
||||||
//if ((long) diff > 0) {
|
//if ((long) diff > 0) {
|
||||||
@ -345,12 +334,20 @@ public class Scheduler extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if (t <= ct) {
|
// if (t <= ct) {
|
||||||
|
|
||||||
SortedSet s = event_queue.get(t);
|
SortedSet s = event_queue.get(t);
|
||||||
Object rc = event_queue.remove(t);
|
Object rc = event_queue.remove(t);
|
||||||
|
|
||||||
|
if (s.size() > 1) {
|
||||||
|
System.out.printf("Events in a row: %d\n", s.size());
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<TimerTaskDef> it = s.iterator();
|
Iterator<TimerTaskDef> it = s.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
TimerTaskDef e = it.next();
|
TimerTaskDef e = it.next();
|
||||||
|
if (s.size() > 1) {
|
||||||
|
System.out.printf("Sicku: %d %d\n", e.id, e.curevtime);
|
||||||
|
}
|
||||||
|
|
||||||
long next_t = this.fireEvent(e.taskRunner);
|
long next_t = this.fireEvent(e.taskRunner);
|
||||||
e.newevtime = next_t + t;
|
e.newevtime = next_t + t;
|
||||||
this.addTimerTask(e);
|
this.addTimerTask(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user