/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hw4_multithreadtrucks; import java.util.*; import pbxlogique.Pbx; /** * * @author Peilos */ public class TimeCal { long startTime, currentTime; public void TakeStartTime() { GregorianCalendar gcl = new GregorianCalendar(); gcl.setTime(new Date()); startTime = gcl.getTimeInMillis(); } long getNewTimeDifference() { GregorianCalendar gcl = new GregorianCalendar(); gcl.setTime(new Date()); currentTime = gcl.getTimeInMillis(); return (currentTime - startTime); } @SuppressWarnings("empty-statement") public void RunForSomeTime(long timeInMillis) { this.TakeStartTime(); while(this.getNewTimeDifference()