Index: applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java
===================================================================
--- applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java	(revision 13498)
+++ applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java	(revision 13499)
@@ -10,4 +10,5 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -18,4 +19,5 @@
 import org.openstreetmap.josm.io.tcx.ActivityT;
 import org.openstreetmap.josm.io.tcx.CourseT;
+import org.openstreetmap.josm.io.tcx.PositionT;
 import org.openstreetmap.josm.io.tcx.TrackT;
 import org.openstreetmap.josm.io.tcx.TrackpointT;
@@ -86,4 +88,31 @@
     }
 
+    /** Convert a TrackpointT to a WayPoint.
+     * @param tp	TrackpointT to convert
+     * @return		tp converted to WayPoint, or null
+     */
+    private static WayPoint convertPoint(TrackpointT tp) {
+
+        PositionT p = tp.getPosition();
+
+        if (p == null) {
+            // If the TrackPointT lacks a position, return null.
+            return null;
+        }
+
+        WayPoint waypt = new WayPoint(new LatLon(p.getLatitudeDegrees(),
+                                                 p.getLongitudeDegrees()));
+        // If WayPoint handled elevation data, we could get it from
+        // tp.getAltitudeMeters().
+
+        XMLGregorianCalendar time = tp.getTime();
+
+        if (time != null) {
+            waypt.time = .001 * time.toGregorianCalendar().getTimeInMillis();
+        }
+
+        return waypt;
+    }
+
     /**
      * @param tcd
@@ -102,28 +131,10 @@
                                     Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
                                     currentTrack.trackSegs.add(currentTrackSeg);
-                                    for (TrackpointT trackpoint : track
-                                            .getTrackpoint()) {
-                                        // Some trackspoints don't have a
-                                        // position.
-                                        // Check it
-                                        // first to avoid an NPE!
-                                        if (trackpoint.getPosition() != null) {
-                                            LatLon latLon = new LatLon(
-                                                    trackpoint
-                                                            .getPosition()
-                                                            .getLatitudeDegrees(),
-                                                    trackpoint
-                                                            .getPosition()
-                                                            .getLongitudeDegrees());
-                                            WayPoint currentWayPoint = new WayPoint(
-                                                    latLon);
-                                            // We usually have altitude info
-                                            // here
-                                            // (trackpoint.getAltitudeMeters())
-                                            // Don't know how to add it to
-                                            // the GPX
-                                            // Data...
-                                            currentTrackSeg
-                                                    .add(currentWayPoint);
+                                    for (TrackpointT tp :
+                                           track.getTrackpoint()) {
+                                        WayPoint waypt = convertPoint(tp);
+
+                                        if (waypt != null) {
+                                            currentTrackSeg.add(waypt);
                                         }
                                     }
@@ -151,21 +162,9 @@
                             Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
                             currentTrack.trackSegs.add(currentTrackSeg);
-                            for (TrackpointT trackpoint : track.getTrackpoint()) {
-                                // Some trackspoints don't have a position.
-                                // Check it
-                                // first to avoid an NPE!
-                                if (trackpoint.getPosition() != null) {
-                                    LatLon latLon = new LatLon(
-                                            trackpoint.getPosition()
-                                                    .getLatitudeDegrees(),
-                                            trackpoint.getPosition()
-                                                    .getLongitudeDegrees());
-                                    WayPoint currentWayPoint = new WayPoint(
-                                            latLon);
-                                    // We usually have altitude info here
-                                    // (trackpoint.getAltitudeMeters())
-                                    // Don't know how to add it to the GPX
-                                    // Data...
-                                    currentTrackSeg.add(currentWayPoint);
+                            for (TrackpointT tp : track.getTrackpoint()) {
+                                WayPoint waypt = convertPoint(tp);
+
+                                if (waypt != null) {
+                                    currentTrackSeg.add(waypt);
                                 }
                             }
