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/tools/date/DateUtils.java

    r14159 r14434  
    153153     * @since 14055
    154154     */
    155     public static synchronized String fromTimestamp(long timestamp) {
    156         final ZonedDateTime temporal = Instant.ofEpochMilli(TimeUnit.SECONDS.toMillis(timestamp)).atZone(ZoneOffset.UTC);
     155    public static String fromTimestamp(long timestamp) {
     156        return fromTimestampInMillis(TimeUnit.SECONDS.toMillis(timestamp));
     157    }
     158
     159    /**
     160     * Formats a date to the XML UTC format regardless of current locale.
     161     * @param timestamp number of milliseconds since the epoch
     162     * @return The formatted date
     163     * @since 14434
     164     */
     165    public static synchronized String fromTimestampInMillis(long timestamp) {
     166        final ZonedDateTime temporal = Instant.ofEpochMilli(timestamp).atZone(ZoneOffset.UTC);
    157167        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(temporal);
    158168    }
     
    164174     */
    165175    public static synchronized String fromTimestamp(int timestamp) {
    166         return fromTimestamp((long) timestamp);
     176        return fromTimestamp(Integer.toUnsignedLong(timestamp));
    167177    }
    168178
Note: See TracChangeset for help on using the changeset viewer.