Ignore:
Timestamp:
2021-04-09T00:19:56+02:00 (3 years ago)
Author:
simon04
Message:

see #14176 - Utils.getDurationString in GpxLayer.formatTimespan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r17715 r17718  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.layer;
    3 
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.trn;
    6 
    7 import java.awt.Color;
    8 import java.awt.Dimension;
    9 import java.awt.Graphics2D;
    10 import java.awt.event.ActionEvent;
    11 import java.io.File;
    12 import java.time.Instant;
    13 import java.time.format.DateTimeFormatter;
    14 import java.time.format.FormatStyle;
    15 import java.time.temporal.ChronoUnit;
    16 import java.util.ArrayList;
    17 import java.util.Arrays;
    18 import java.util.Collections;
    19 import java.util.Date;
    20 import java.util.List;
    21 import java.util.NoSuchElementException;
    22 import java.util.stream.Collectors;
    23 
    24 import javax.swing.AbstractAction;
    25 import javax.swing.Action;
    26 import javax.swing.Icon;
    27 import javax.swing.JScrollPane;
    28 import javax.swing.SwingUtilities;
    293
    304import org.openstreetmap.josm.actions.AutoScaleAction;
     
    6842import org.openstreetmap.josm.tools.date.DateUtils;
    6943
     44import javax.swing.AbstractAction;
     45import javax.swing.Action;
     46import javax.swing.Icon;
     47import javax.swing.JScrollPane;
     48import javax.swing.SwingUtilities;
     49import java.awt.Color;
     50import java.awt.Dimension;
     51import java.awt.Graphics2D;
     52import java.awt.event.ActionEvent;
     53import java.io.File;
     54import java.time.Instant;
     55import java.time.format.DateTimeFormatter;
     56import java.time.format.FormatStyle;
     57import java.util.ArrayList;
     58import java.util.Arrays;
     59import java.util.Collections;
     60import java.util.Date;
     61import java.util.List;
     62import java.util.NoSuchElementException;
     63import java.util.stream.Collectors;
     64
     65import static org.openstreetmap.josm.tools.I18n.tr;
     66import static org.openstreetmap.josm.tools.I18n.trn;
     67
    7068/**
    7169 * A layer that displays data from a Gpx file / the OSM gpx downloads.
     
    178176            DateTimeFormatter tf = DateUtils.getTimeFormatter(FormatStyle.SHORT);
    179177            ts += earliestDate + ' ';
    180             ts += tf.format(bounds[0]) + " - " + tf.format(bounds[1]);
     178            ts += tf.format(bounds[0]) + " \u2013 " + tf.format(bounds[1]);
    181179        } else {
    182180            DateTimeFormatter dtf = DateUtils.getDateTimeFormatter(FormatStyle.SHORT, FormatStyle.MEDIUM);
    183             ts += dtf.format(bounds[0]) + " - " + dtf.format(bounds[1]);
    184         }
    185 
    186         long diff = ChronoUnit.SECONDS.between(bounds[1], bounds[0]);
    187         ts += String.format(" (%d:%02d)", diff / 3600, (diff % 3600) / 60);
     181            ts += dtf.format(bounds[0]) + " \u2013 " + dtf.format(bounds[1]);
     182        }
     183
     184        ts += String.format(" (%s)", Utils.getDurationString(bounds[1].toEpochMilli() - bounds[0].toEpochMilli()));
    188185        return ts;
    189186    }
Note: See TracChangeset for help on using the changeset viewer.