Index: src/org/openstreetmap/josm/data/gpx/WayPoint.java =================================================================== --- src/org/openstreetmap/josm/data/gpx/WayPoint.java (revision 808) +++ src/org/openstreetmap/josm/data/gpx/WayPoint.java (working copy) @@ -34,9 +34,8 @@ /** * Convert the time stamp of the waypoint into seconds from the epoch */ - public void setTime () { + public void setTime() { if (! attr.containsKey("time")) { - time = 0.0; return; } SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone @@ -41,9 +40,32 @@ } SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone Date d = f.parse(attr.get("time").toString(), new ParsePosition(0)); - if (d == null /* failed to parse */) { - time = 0.0; - } else { + if (d != null /* parsing ok */) { + time = d.getTime() / 1000.0; /* ms => seconds */ + } + } + + /** + * Convert a time stamp of the waypoint from the or field + * into seconds from the epoch. Handles the date format as it is used by + * Garmin handhelds. Does not overwrite an existing timestamp (!= 0.0). + * A value of