- Timestamp:
- 2018-11-23T20:59:30+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r14434 r14445 3 3 4 4 import java.awt.Color; 5 import java.time.DateTimeException;6 5 import java.util.ArrayList; 7 6 import java.util.Date; … … 15 14 import org.openstreetmap.josm.data.projection.Projecting; 16 15 import org.openstreetmap.josm.tools.Logging; 17 import org.openstreetmap.josm.tools.UncheckedParseException;18 import org.openstreetmap.josm.tools.date.DateUtils;19 16 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider; 20 17 … … 136 133 public void setTime(Date time) { 137 134 this.time = time.getTime() / 1000.; 138 this.attr.put(PT_TIME, DateUtils.fromDate(time));135 this.attr.put(PT_TIME, time); 139 136 } 140 137 … … 156 153 */ 157 154 public void setTime(long ts) { 158 this.time = ts; 159 this.attr.put(PT_TIME, DateUtils.fromTimestamp(ts)); 155 setTimeInMillis(ts*1000); 160 156 } 161 157 … … 168 164 public void setTimeInMillis(long ts) { 169 165 this.time = ts / 1000.; 170 this.attr.put(PT_TIME, DateUtils.fromTimestampInMillis(ts));166 this.attr.put(PT_TIME, new Date(ts)); 171 167 } 172 168 … … 178 174 public Date setTimeFromAttribute() { 179 175 if (attr.containsKey(PT_TIME)) { 180 try {181 final Object obj = get(PT_TIME);182 final Date date = obj instanceof Date ? (Date) obj : DateUtils.fromString(obj.toString());176 final Object obj = get(PT_TIME); 177 if (obj instanceof Date) { 178 final Date date = (Date) obj; 183 179 time = date.getTime() / 1000.; 184 180 return date; 185 } catch (UncheckedParseException | DateTimeException e){186 Logging.warn( e);181 } else { 182 Logging.warn("Unsupported waypoint {0} value: {1}", PT_TIME, obj); 187 183 time = 0; 188 184 }
Note:
See TracChangeset
for help on using the changeset viewer.