Reputation: 1554
i need to can we implement showing a label with total time taken for the process to execute in JAVA? and how? any code spinet?
Upvotes: 1
Views: 277
Reputation: 14788
use timestamps
when your executable starts call:
startTime = System.nanoTime();
And store the result in a known location. Then whenever you want to figure out how long you have been running just:
totalTime = System.nanoTime()-startTime;
totaltime will hold the total executtion time in nanoseconds. you could set some sort of timer even to call this and update a label if you want to constantly update it.
Upvotes: 4