I have the following problem:
I need a clock, which first to take the value of the system time,
and then to be increased every second; I tryed to do this with a
thread, but after a couple of minutes, there are differences between my clock and the system clock; how can I do to eliminate this difference ?
the run() method has the following code
public void run()
{
Calendar c= Calendar.getInstance();
while (true) {
try {
Thread.sleep(1000);
c.add(Calendar.SECOND,1);
jLabel1.setText(c.getTime().toString());
jLabel2.setText(Calendar.getInstance().getTime ().toString());
} catch(InterruptedException interruptedexception){}
}
}