Ticket #1896: gpxtime.patch

File gpxtime.patch, 991 bytes (added by Teemu Koskinen <teemu.koskinen@…>, 12 years ago)

This patch should fix the bug

  • src/org/openstreetmap/josm/data/gpx/WayPoint.java

     
    3636     */
    3737    public final static SimpleDateFormat GPXTIMEFMT =
    3838        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); // ignore timezone
     39    public final static SimpleDateFormat GPXTIMEFMT2 =
     40        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone
    3941
    4042    public void setTime() {
    4143        if (! attr.containsKey("time")) {
    4244            return;
    4345        }
    4446        Date d = GPXTIMEFMT.parse(attr.get("time").toString(), new ParsePosition(0));
     47        if (d == null) {
     48            d = GPXTIMEFMT2.parse(attr.get("time").toString(), new ParsePosition(0));
     49        }
    4550        if (d != null /* parsing ok */) {
    4651            time = d.getTime() / 1000.0; /* ms => seconds */
    4752        }