Changeset 552 in josm for trunk/src/org/openstreetmap/josm/data/gpx
- Timestamp:
- 2008-02-20T18:53:10+01:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r444 r552 3 3 4 4 package org.openstreetmap.josm.data.gpx; 5 6 import java.text.ParsePosition; 7 import java.text.SimpleDateFormat; 8 import java.util.Date; 5 9 6 10 import org.openstreetmap.josm.Main; … … 22 26 return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + latlon.toString() + ", " + attr + ")"; 23 27 } 28 29 /** 30 * convert the time stamp of ther waypoint into seconds from the epoch 31 * @return seconds 32 */ 33 public double time () { 34 if (! attr.containsKey("time")) 35 return 0.0; 36 SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone 37 Date d = f.parse(attr.get("time").toString(), new ParsePosition(0)); 38 if (d == null /* failed to parse */) 39 return 0.0; 40 return d.getTime() / 1000.0; /* ms => seconds */ 41 } 42 24 43 }
Note:
See TracChangeset
for help on using the changeset viewer.
