public static String formatETA(long eta) { return( formatETA( eta, false )); }
@Override public String getETA() { return(DisplayFormatters.formatETA(dm_stats.getSmoothedETA())); }
public static String formatETA( long value, boolean absolute, SimpleDateFormat override ) { SimpleDateFormat df = override!=null?override:formatOverride; if ( absolute && df != null && value > 0 && !(value == Constants.CRAPPY_INFINITY_AS_INT || value >= Constants.CRAPPY_INFINITE_AS_LONG )){ try{ return( df.format( new Date( SystemTime.getCurrentTime() + 1000*value ))); }catch( Throwable e ){ } } return( DisplayFormatters.formatETA( value, absolute )); }
@Override public void cellHover(TableCell cell) { Object ds = cell.getSortValue(); if (ds instanceof Number) { long timestamp = ((Number) ds).longValue(); if ( timestamp > 0 ){ long eta = (SystemTime.getCurrentTime() - timestamp) / 1000; if (eta > 0) { cell.setToolTip(DisplayFormatters.formatETA(eta, false) + " " + MessageText.getString("label.ago")); } } } } @Override
eta_str = last_eta_str = num_downloading==0?"":DisplayFormatters.formatETA(min_eta);
@Override public void refresh(TableCell cell) { PEPeer peer = (PEPeer)cell.getDataSource(); long value = (peer == null) ? Long.MAX_VALUE : peer.getStats().getEstimatedSecondsToCompletion(); if (!cell.setSortValue(value) && cell.isValid()) return; if ( value > 7*24*60*60 ){ value = Long.MAX_VALUE; } cell.setText(DisplayFormatters.formatETA(value)); } }
toolTip.append( etaKeyVal ); toolTip.append( "=" ); toolTip.append( DisplayFormatters.formatETA( next_download_eta )); toolTip.append( "\n" );
s = (completed / 10) + "% Complete\n"; String eta = DisplayFormatters.formatETA( manager.getStats().getSmoothedETA()); if (eta.length() > 0) {
@Override public void cellHover(TableCell cell) { super.cellHover(cell); Object oTooltip = cell.getToolTip(); String s = (oTooltip instanceof String) ? (String) oTooltip + "\n" : ""; DownloadManager dm = (DownloadManager) cell.getDataSource(); long dateAdded = (dm == null) ? 0 : dm.getDownloadState().getLongParameter( DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME); if (dateAdded != 0) { s += MessageText.getString("TableColumn.header.date_added") + ": " + DisplayFormatters.formatDate(dateAdded) + " (" + DisplayFormatters.formatETA((SystemTime.getCurrentTime() - dateAdded) / 1000, false) + ")"; cell.setToolTip(s); } } }
long total_up_time = totalStats.getTotalUpTime( true ); sessionTime.setText( session_up_time==0?"":DisplayFormatters.formatETA( session_up_time )); totalTime.setText( total_up_time==0?"":DisplayFormatters.formatETA( total_up_time )); socksFails.setText( last_fail<0?"":(DisplayFormatters.formatETA( fail_ago_secs, false ) + " " + MessageText.getString( "label.ago" ) + ", tot=" + total_fails ));
@Override protected void refresh0() { GlobalManagerStats stats = g_manager.getStats(); this.updateSpeedLabel(down_speed, stats.getDataReceiveRate(),stats.getProtocolReceiveRate()); this.updateSpeedLabel(up_speed, stats.getDataSendRate(),stats.getProtocolSendRate()); long min_eta = Long.MAX_VALUE; int num_downloading = 0; List<DownloadManager> dms = g_manager.getDownloadManagers(); for ( DownloadManager dm: dms ){ if ( dm.getState() == DownloadManager.STATE_DOWNLOADING ){ num_downloading++; long eta = dm.getStats().getSmoothedETA(); if ( eta < min_eta ){ min_eta = eta; } } } if ( min_eta == Long.MAX_VALUE ){ min_eta = Constants.CRAPPY_INFINITE_AS_LONG; } next_eta.setText(num_downloading==0?"":DisplayFormatters.formatETA(min_eta)); }
@Override protected void refresh0() { DownloadManagerStats stats = download.getStats(); download_name.setText(download.getDisplayName()); int percent = stats.getPercentDoneExcludingDND(); this.updateSpeedLabel(down_speed, stats.getDataReceiveRate(), stats.getProtocolReceiveRate()); this.updateSpeedLabel(up_speed, stats.getDataSendRate(), stats.getProtocolSendRate()); eta.setText(DisplayFormatters.formatETA(stats.getSmoothedETA())); if (progress_bar.getSelection() != percent) { progress_bar.setSelection(percent); progress_bar.redraw(); } }
return DisplayFormatters.formatByteCountToKiBEtc(dm.getSize()); case 'e': return DisplayFormatters.formatETA(dm.getStats().getSmoothedETA()); case 'r': long to = 0;
socks_fails.setText( last_fail<0?"":(DisplayFormatters.formatETA( fail_ago_secs, false ) + " " + MessageText.getString( "label.ago" ) + ", tot=" + total_fails ));
next_eta_str = Constants.INFINITY_STRING + ": "; }else{ next_eta_str = DisplayFormatters.formatETA(next_eta) + ": ";
String eta = DisplayFormatters.formatETA(manager.getStats().getSmoothedETA());
writeTag( "ETA", DisplayFormatters.formatETA(dm_stats.getSmoothedETA())); writeTag( "HASH_FAILS", dm_stats.getHashFailCount()); writeTag( "SHARE_RATIO", dm_stats.getShareRatio());