How to get total time of running program

Reply

Join Date: May 2007
Posts: 1
Reputation: eena75 is an unknown quantity at this point 
Solved Threads: 0
eena75 eena75 is offline Offline
Newbie Poster

How to get total time of running program

 
0
  #1
May 23rd, 2007
Hai,
I write a simulation and need to set the time for running the simulation. the simulation should stop based on the time that heve been set .How to set start time, get the current time and lastly to get the total time of java running program? really hope u can help me asap
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: How to get total time of running program

 
0
  #2
May 23rd, 2007
So what have u tried so far.. ?
Post the code you've done..
Are you Agile.. ?
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to get total time of running program

 
0
  #3
May 23rd, 2007
1) we don't do your homework for you, show some effort
2) we're certainly not going to let you order us around to do it "asap". If and when we do anything it'll be at a time and place of our choosing, not yours, suggesting anything else makes us LESS eager to help you.
3) (general warning) it's NOT "urgent" to anyone except possibly you, and if it is you should have started sooner.
4) properly define your problem domain. WHAT do you want to measure exactly? What that is defines where and how to measure it.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 39
Reputation: babyfrostie is an unknown quantity at this point 
Solved Threads: 0
babyfrostie babyfrostie is offline Offline
Light Poster

Re: How to get total time of running program

 
0
  #4
Jan 11th, 2008
can someone teach me how to get the running time of this program?
  1. import java.io.*;
  2. public class ArrauSample {
  3.  
  4. public static void main(String args[]){
  5.  
  6. BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
  7. int x=0;
  8. int max= 5;
  9.  
  10. int myNum[] = new int[max];
  11. String myString[] = new String[max];
  12.  
  13. try{
  14. for(x=0; x<max; x++)
  15. {
  16. System.out.println("Input element #" + (x+1));
  17. myString[x]=console.readLine();
  18. }
  19. }catch(IOException e){}
  20.  
  21. for(x=0; x<max; x++)
  22. {
  23. System.out.print("Element #" + (x+1));
  24. System.out.println(myString[x]);
  25. }
  26.  
  27.  
  28. }
  29.  
  30.  
  31. }
thank you very much!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 55
Reputation: mickinator is an unknown quantity at this point 
Solved Threads: 5
mickinator mickinator is offline Offline
Junior Poster in Training

Re: How to get total time of running program

 
0
  #5
Jan 11th, 2008
Well the basic way of getting time in a program is to use

long x = System.getCurrentTime();

which returns the current time of the computer in milliseconds.

Anyone with a brain could figure it out from there! :p
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 39
Reputation: babyfrostie is an unknown quantity at this point 
Solved Threads: 0
babyfrostie babyfrostie is offline Offline
Light Poster

Re: How to get total time of running program

 
0
  #6
Jan 11th, 2008
ammm we should compute it with our hands lol..
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 55
Reputation: mickinator is an unknown quantity at this point 
Solved Threads: 5
mickinator mickinator is offline Offline
Junior Poster in Training

Re: How to get total time of running program

 
0
  #7
Jan 12th, 2008
ive an abacus if you want one
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 224
Reputation: bugmenot is an unknown quantity at this point 
Solved Threads: 31
bugmenot bugmenot is offline Offline
Posting Whiz in Training

Re: How to get total time of running program

 
0
  #8
Jan 12th, 2008
Originally Posted by mickinator View Post
Well the basic way of getting time in a program is to use

long x = System.getCurrentTime();

which returns the current time of the computer in milliseconds.

Anyone with a brain could figure it out from there! :p
there is no such method in my Java API

perhaps you are thinking of System.currentTimeMillis()
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 55
Reputation: mickinator is an unknown quantity at this point 
Solved Threads: 5
mickinator mickinator is offline Offline
Junior Poster in Training

Re: How to get total time of running program

 
0
  #9
Jan 12th, 2008
Lol, my mistake, thats it right there.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC