Ticket #11844: time_estimate.patch
File time_estimate.patch, 1.7 KB (added by , 6 years ago) |
---|
-
photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java
236 236 progressMonitor.subTask(tr("Writing position information to image files...")); 237 237 progressMonitor.setTicksCount(images.size()); 238 238 239 final long startTime = System.currentTimeMillis(); 240 239 241 currentIndex = 0; 240 242 while (currentIndex < images.size()) { 241 243 if (canceled) return; … … 275 277 } 276 278 } 277 279 progressMonitor.worked(1); 280 281 float millisecsPerFile = ((float)(System.currentTimeMillis()-startTime))/((currentIndex+1)); // currentIndex starts at 0 282 int filesLeft = images.size()-currentIndex-1; 283 int secsLeft = (int)Math.ceil((millisecsPerFile*filesLeft/1000)); 284 String timeLeft; 285 if (secsLeft < 60) { 286 timeLeft = secsLeft + "s"; 287 } else if (secsLeft < 3600) { 288 timeLeft = secsLeft/60 + "min " + secsLeft%60 + "s"; 289 } else { 290 timeLeft = secsLeft/3600 + "h " + ((secsLeft)/60)%60 + "min " + secsLeft%60 + "s"; 291 } 292 progressMonitor.subTask(tr("Writing position information to image files... Estimated time left: {0}", timeLeft)); 293 278 294 if (debug) { 279 295 System.err.println("finished " + e.getFile()); 280 296 }