public double getDownloadDur()
	{
		if(done==true)
			return downloadDur;
		
		double fileSize = playbackTime * bitrate;
		double time = downloadStartTime;
		
		double bwTotal = 0;
		int bwCnt = 0;
		while(fileSize>0)
		{
			double bw = 0;
			
			for(int i=0;i<block.getServerSize();i++)
			{
				bw += block.getSch().getX(id, i) * block.getSlist().getLserver().get(i).getBandwidth(time);
			}
			double downloadTempDur = 0;
			
			double downloadSize = (Math.ceil(time+0.0000000001) - time) * bw;
			//System.out.println("bw = " + bw + " downloadSize = "+downloadSize);
			
			bwTotal += bw;
			bwCnt ++;
			
			if(fileSize - downloadSize>=0){
				downloadTempDur = Math.ceil(time+0.0000000001) - time;
				fileSize -= downloadSize;
				tline.setBufferSize((int) Math.floor(time), downloadSize/bitrate);
				tline.setServerBufferSize(downloadedBy.getId()-1, (int) Math.floor(time), downloadSize/bitrate);
				
				
			}
			else
			{
				//double s = fileSize;
				downloadTempDur = fileSize / bw;
				tline.setBufferSize((int) Math.floor(time), fileSize/bitrate);
				tline.setServerBufferSize(downloadedBy.getId()-1, (int) Math.floor(time), fileSize/bitrate);
				fileSize = 0;
			}
			time += downloadTempDur;
		}
		
		downloadDur = time - downloadStartTime;
		downloadEndTime = time;
		if(downloadedBy!=null)
		{
			Fragment next = downloadedBy.getNextFragment(this,block);
			if(next!=null)
				next.downloadStartTime = downloadEndTime;
		}
		done=true;
		//System.out.println("id " + block.getId() +"/"+id + ":" + downloadedBy.getId()+" - > downloadStartTime:" + downloadStartTime + " downloadEndTime:" + downloadEndTime);
		if(block.getServerSize()!=1)
			System.out.println(downloadedBy.getId() + " " + block.getId()+" "+ id + " " +"0 " + downloadEndTime + " " + bitrate + " " + buffer.getBufferLengthWithBlocknFrag(block, this) + " " + bwTotal/bwCnt);
		else if(block.getServerSize()==1)
			System.out.println(downloadedBy.getId() + " " + block.getId()+" "+ id + " " +"0 " + downloadEndTime + " " + bitrate + " " + buffer.getBlockEndBufferLength(block) + " " + bwTotal/bwCnt);
		//System.out.println(downloadedBy.getId() + " " + block.getId()+" "+ id + " " +"0 " + downloadStartTime + " " + bitrate + " " + buffer.getBufferLengthWithBlocknFrag(block, this));

		return downloadDur;
	}