Ignore:
Timestamp:
2018-11-20T01:13:10+01:00 (3 months ago)
Author:
Don-vip
Message:

fix #16995 - fix timestamp in GPX exports (patch by cmuelle8) + use Java 8 unsigned int API

File:
1 edited

Legend:

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

    r14430 r14434  
    781781     */
    782782    public static WayPoint nodeToWayPoint(Node n) {
    783         return nodeToWayPoint(n, 0);
     783        return nodeToWayPoint(n, Long.MIN_VALUE);
    784784    }
    785785
    786786    /**
    787787     * @param n the {@code Node} to convert
    788      * @param time a time value in milliseconds from the epoch.
     788     * @param time a timestamp value in milliseconds from the epoch.
    789789     * @return {@code WayPoint} object
    790790     * @since 13210
     
    798798
    799799        try {
    800             if (time > 0) {
    801                 wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(time));
    802                 wpt.setTime(time);
     800            if (time > Long.MIN_VALUE) {
     801                wpt.setTimeInMillis(time);
    803802            } else if (n.hasKey(GpxConstants.PT_TIME)) {
    804                 wpt.put(GpxConstants.PT_TIME, DateUtils.fromString(n.get(GpxConstants.PT_TIME)));
    805                 wpt.setTime();
     803                wpt.setTime(DateUtils.fromString(n.get(GpxConstants.PT_TIME)));
    806804            } else if (!n.isTimestampEmpty()) {
    807                 wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(n.getRawTimestamp()));
    808                 wpt.setTime();
     805                wpt.setTime(Integer.toUnsignedLong(n.getRawTimestamp()));
    809806            }
    810807        } catch (UncheckedParseException e) {
Note: See TracChangeset for help on using the changeset viewer.