Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyTimer extends Thread
- {
- private long startime;
- MyTimer(long start){
- startime = start;
- }
- @Override
- public void run()
- {
- try
- {
- do
- {
- long miliseconds;
- miliseconds = System.currentTimeMillis() - startime;
- System.out.println("Прошло времени: " + (miliseconds / (1000*60)) % 60 + " : " + (miliseconds / 1000) % 60 + " : " + miliseconds % 1000);
- sleep(1);
- }while(!this.isInterrupted());
- }
- catch(Exception e)
- {
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement