Here's an ugly little program I wrote to probe this interaction between
Behaviors and the OS clock. By poking around some, I persuaded myself that
the WakeupOnElapsedTime() Behavior was driven by the same mechanism as the
Object.wait() method. The enclosed application gives the following output:
dt is the argument to the wait(dt) in milliseconds, and OSdt is the realized
delay time in milliseconds. I haven't successfully run this on anything but
WinNT and W2000k.
---------------------------------------------------------
Run 3/6/01 3:45 PM
os.name: Windows 2000
os.arch: x86
os.version: 5.0
dt OSdt
---- ----
1 16 ********
2 15 ********
3 16 ********
4 15 ********
5 16 ********
6 16 ********
7 15 ********
8 16 ********
9 16 ********
10 15 ********
11 16 ********
12 15 ********
13 16 ********
14 16 ********
15 15 ********
16 32 ****************
17 31 ****************
18 31 ****************
19 31 ****************
20 32 ****************
21 31 ****************
22 31 ****************
23 31 ****************
24 32 ****************
25 31 ****************
26 31 ****************
27 31 ****************
28 32 ****************
29 31 ****************
30 31 ****************
31 31 ****************
32 47 ************************
33 47 ************************
34 47 ************************
35 47 ************************
36 47 ************************
37 47 ************************
38 46 ***********************
39 47 ************************
40 47 ************************
41 47 ************************
42 47 ************************
43 47 ************************
44 47 ************************
45 47 ************************
46 46 ***********************
47 63 ********************************
48 62 *******************************
49 63 ********************************
press any key to exit...
----------------------------------------------------------------------------
-
import javax.media.j3d.*;
import java.util.*;
import java.text.*;
class waittest {
public static DateFormat DayTime;
public static void main(String arg[]){
waittest wt = new waittest();
wt.DayTime = DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.SHORT);
System.out.println("");
System.out.println("Run "+DayTime.format(new Date()));
System.out.println("os.name: "+System.getProperty("os.name"));
System.out.println("os.arch: "+System.getProperty("os.arch"));
System.out.println("os.version: "+System.getProperty("os.version"));
System.out.println("");
System.out.println("dt\tOSdt");
System.out.println("----\t----");
for (int delay = 1; delay<50; delay++) {
long start = System.currentTimeMillis();
wt.waitStep(delay);
int step = (int) (System.currentTimeMillis()-start);
String s = new String();
for (int i = 0;i<step; i+=2) {s = s + "*";}
System.out.println(delay+"\t"+step+"\t"+s);
}
}
public synchronized void waitStep(long t) {
try{this.wait(t);}
catch(InterruptedException e) {}
}
}
---------------------------------------------------------------------
Cheers,
Fred Klingener
Brock Engineering
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".