1,105,386 Community Members

setting a delay?

Member Avatar
game06
Junior Poster
109 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

does any knows how to set a delay in japple - timmer? before running test method i want to set one sec dalay.

public void test()
{
    //some code here
}

i tried this but didnt work.

public void test()
{
    int i = 10000;
    while(i >= 0){
        i--;
    }

    //some code here
}

also tried:

public void test()
    {
     timerClass.setDelay(1000);
        int i = 10000;
        while(i >= 0){
            i--;
        }

        //some code here
    }


                                    }
Member Avatar
rubberman
Senior Poster
3,999 posts since Mar 2010
Reputation Points: 513 [?]
Q&As Helped to Solve: 501 [?]
Skill Endorsements: 87 [?]
 
0
 

Modern systems can decrement a 10K value in about 10 nanoseconds. This is not the approach you want to take. There are system timers that will handle timers in nanosecond scales quite nicely. Is this a Java application?

Member Avatar
Dani
The Queen of DaniWeb
20,569 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 931 [?]
Skill Endorsements: 204 [?]
Administrator
Featured
Sponsor
 
0
 

Try putting that setDelay() code inside your loop.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article