Changeset 8565 in josm for trunk/src/org
- Timestamp:
- 2015-07-04T18:31:20+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8512 r8565 567 567 568 568 if ("timestamp".equals(key)) { 569 mv = DateUtils.from Date(osm.getTimestamp());569 mv = DateUtils.fromTimestamp(osm.getRawTimestamp()); 570 570 } else { 571 571 mv = osm.get(key); … … 1087 1087 @Override 1088 1088 protected Long getNumber(OsmPrimitive osm) { 1089 return osm.get Timestamp().getTime();1089 return osm.getRawTimestamp() * 1000L; 1090 1090 } 1091 1091 -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r8540 r8565 292 292 } 293 293 294 @Override 295 public void setRawTimestamp(int timestamp) { 296 this.timestamp = timestamp; 297 } 298 294 299 /** 295 300 * Time of last modification to this object. This is not set by JOSM but … … 302 307 public Date getTimestamp() { 303 308 return new Date(timestamp * 1000L); 309 } 310 311 @Override 312 public int getRawTimestamp() { 313 return timestamp; 304 314 } 305 315 -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r8540 r8565 100 100 target.setVisible(source.isVisible()); 101 101 target.setUser(source.getUser()); 102 target.set Timestamp(source.getTimestamp());102 target.setRawTimestamp(source.getRawTimestamp()); 103 103 target.setModified(source.isModified()); 104 104 objectsWithChildrenToMerge.add(source.getPrimitiveId()); -
trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java
r8510 r8565 41 41 Date getTimestamp(); 42 42 43 int getRawTimestamp(); 44 43 45 void setTimestamp(Date timestamp); 46 47 void setRawTimestamp(int timestamp); 44 48 45 49 boolean isTimestampEmpty(); -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r8510 r8565 1228 1228 // Write lock is provided by subclasses 1229 1229 setKeys(data.getKeys()); 1230 set Timestamp(data.getTimestamp());1230 setRawTimestamp(data.getRawTimestamp()); 1231 1231 user = data.getUser(); 1232 1232 setChangesetId(data.getChangesetId()); … … 1250 1250 data.setId(id); 1251 1251 data.setKeys(getKeys()); 1252 data.set Timestamp(getTimestamp());1252 data.setRawTimestamp(getRawTimestamp()); 1253 1253 data.setUser(user); 1254 1254 data.setDeleted(isDeleted()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r8498 r8565 233 233 add(tr("Data Set: "), Integer.toHexString(o.getDataSet().hashCode())); 234 234 add(tr("Edited at: "), o.isTimestampEmpty() ? tr("<new object>") 235 : DateUtils.from Date(o.getTimestamp()));235 : DateUtils.fromTimestamp(o.getRawTimestamp())); 236 236 add(tr("Edited by: "), o.getUser() == null ? tr("<new object>") 237 237 : getNameAndId(o.getUser().getName(), o.getUser().getId())); -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r8540 r8565 597 597 598 598 if (!n.isTimestampEmpty()) { 599 wpt.put("time", DateUtils.from Date(n.getTimestamp()));599 wpt.put("time", DateUtils.fromTimestamp(n.getRawTimestamp())); 600 600 wpt.setTime(); 601 601 } -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r8510 r8565 299 299 } 300 300 if (!osm.isTimestampEmpty()) { 301 out.print(" timestamp='"+DateUtils.from Date(osm.getTimestamp())+"'");301 out.print(" timestamp='"+DateUtils.fromTimestamp(osm.getRawTimestamp())+"'"); 302 302 } 303 303 // user and visible added with 0.4 API -
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r8564 r8565 119 119 } 120 120 121 private static String toXmlFormat(GregorianCalendar cal) { 122 XMLGregorianCalendar xgc = XML_DATE.newXMLGregorianCalendar(cal); 123 if (cal.get(Calendar.MILLISECOND) == 0) { 124 xgc.setFractionalSecond(null); 125 } 126 return xgc.toXMLFormat(); 127 } 128 129 /** 130 * Formats a date to the XML UTC format regardless of current locale. 131 * @param timestamp number of seconds since the epoch 132 * @return The formatted date 133 */ 134 public static synchronized String fromTimestamp(int timestamp) { 135 calendar.setTimeInMillis(timestamp * 1000L); 136 return toXmlFormat(calendar); 137 } 138 121 139 /** 122 140 * Formats a date to the XML UTC format regardless of current locale. … … 126 144 public static synchronized String fromDate(Date date) { 127 145 calendar.setTime(date); 128 XMLGregorianCalendar xgc = XML_DATE.newXMLGregorianCalendar(calendar); 129 if (calendar.get(Calendar.MILLISECOND) == 0) xgc.setFractionalSecond(null); 130 return xgc.toXMLFormat(); 146 return toXmlFormat(calendar); 131 147 } 132 148
Note:
See TracChangeset
for help on using the changeset viewer.