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/data/gpx/WayPoint.java

    r14159 r14434  
    129129
    130130    /**
    131      * Sets the {@link #time} field as well as the {@link #PT_TIME} attribute to the specified time
     131     * Sets the {@link #time} field as well as the {@link #PT_TIME} attribute to the specified time.
    132132     *
    133133     * @param time the time to set
     
    140140
    141141    /**
    142      * Convert the time stamp of the waypoint into seconds from the epoch
    143      */
     142     * Convert the time stamp of the waypoint into seconds from the epoch.
     143     *
     144     * @deprecated call {@link #setTimeFromAttribute()} directly if you need this
     145     */
     146    @Deprecated
    144147    public void setTime() {
    145148        setTimeFromAttribute();
     
    147150
    148151    /**
    149      * Set the the time stamp of the waypoint into seconds from the epoch,
    150      * @param time millisecond from the epoch
     152     * Sets the {@link #time} field as well as the {@link #PT_TIME} attribute to the specified time.
     153     *
     154     * @param ts seconds from the epoch
    151155     * @since 13210
    152156     */
    153     public void setTime(long time) {
    154         this.time = time / 1000.;
     157    public void setTime(long ts) {
     158        this.time = ts;
     159        this.attr.put(PT_TIME, DateUtils.fromTimestamp(ts));
     160    }
     161
     162    /**
     163     * Sets the {@link #time} field as well as the {@link #PT_TIME} attribute to the specified time.
     164     *
     165     * @param ts milliseconds from the epoch
     166     * @since 14434
     167     */
     168    public void setTimeInMillis(long ts) {
     169        this.time = ts / 1000.;
     170        this.attr.put(PT_TIME, DateUtils.fromTimestampInMillis(ts));
    155171    }
    156172
Note: See TracChangeset for help on using the changeset viewer.