Changeset 35426 in osm for applications/editors/josm


Ignore:
Timestamp:
2020-04-18T13:01:12+02:00 (5 years ago)
Author:
simon04
Message:

Use Utils.getDurationString

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java

    r34542 r35426  
    4646import org.openstreetmap.josm.tools.JosmRuntimeException;
    4747import org.openstreetmap.josm.tools.Logging;
     48import org.openstreetmap.josm.tools.Utils;
    4849
    4950/**
     
    279280                progressMonitor.worked(1);
    280281
    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));
     282                float millisecondsPerFile = (float) (System.currentTimeMillis() - startTime)
     283                        / (currentIndex + 1); // currentIndex starts at 0
     284                int filesLeft = images.size() - currentIndex - 1;
     285                String timeLeft = Utils.getDurationString((long) Math.ceil(millisecondsPerFile * filesLeft));
     286                progressMonitor.subTask(tr("Writing position information to image files... Estimated time left: {0}", timeLeft));
    293287
    294288                if (debug) {
Note: See TracChangeset for help on using the changeset viewer.