Hi.
How can I time my while loop to executeevery 3 seconds?
Here is my code:
I seem to have done it right, but it doesn't work...class Info{ public String name; public String version; public String arch; double CPUSpeed; }; Info info = new Info(); Info[] queue = new Info[100]; int pos = 0; for(int i=0;i<100;++i) queue[i] = new Info(); Date d = new Date(); long start = d.getTime(); System.out.println("The starting time is "+ start); while(true){ long time = d.getTime(); if( (start-time)%3 == 0 ) System.out.println("The current time is "+ time); /* queue[pos].name = System.getProperty("os.name"); System.out.println( queue[pos].name); queue[pos].version = System.getProperty("os.version"); queue[pos].arch = System.getProperty("os.arch"); pos++; */ }
What is wrong?
Thanks in advance