• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Program running time

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Heyy..
Could you help me how to make a time for running program?
It should start timing the moment we open the program until when we close it. It works like the timer in the mobile phone.
The value will be displayed in the JTextArea.
btw, Can we actually send the time to JLabel?

Thanks guys!!
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shall it work with different programs, or just with one?

If it works for just one program, it could be a part of the program, but of course couldn't exactly measure from before starting - end of program.
You could display the result in a dialog or frame, which has to be closed, after the rest of the program has finished and stopped the timer.

Another way would be to communicate over sockets, but in this case too, the program started running before sending the message.

Is exactness of milliseconds important?

The last question:
(untestet)
[ September 06, 2004: Message edited by: Stefan Wagner ]
 
Jack Rudolf
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shall it work with different programs, or just with one?
No, it just works on one program only...the exactness of the miliseconds is not important. it just need to be exact to seconds only.!! thanks!
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
let me know if this trick helps you...

it will check approximate milliseconds spend for loop.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you could use the Jakarta Commons Lang StopWatch...
 
Jack Rudolf
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kedar, your method is working. but it does not reset and start from 0 at the starting of the program. It should start from 0 again after u have close the program.
 
reply
    Bookmark Topic Watch Topic
  • New Topic