Need help with Process execution time display
Hi All,
I am new to Java and I am facing problem in displaying the process execution time concurrently while execution is taking place.
I want to diplay time in format mm:ss while the execution is taking place. For the same, i have written code snippet like this,
<----
String s;
long ref = System.currentTimeMillis();
javax.swing.Timer timer2;
SimpleDateFormat timef = new SimpleDateFormat("mm:ss");
timer = new javax.swing.Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
s = timef.format(new Date(System.currentTimeMillis() - ref));
Elapsed.setText("Elapsed Time = " + s);
}
});
timer.start();
---->
Although, I am able to see the Elapsed time, it is always starting from 30:00 . I want to know where I am making a mistake. Would appreciate if you can point it out to me.
Thanks!