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?
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.
精彩评论