Changes between Version 3 and Version 4 of Ticket #16995, comment 17
- Timestamp:
- 2018-11-23T10:02:22+01:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16995, comment 17
v3 v4 229 229 /** 230 230 }}} 231 * or by converting {{{String}}} to {{{Date}}} first, i.e. {{{gpxFormat.format(DateUtils.fromString(p1.get(GpxConstants.PT_TIME)))}}} with no changes {{{Waypoint.java}}} (i.e. PT_TIME attributes stored as {{{String}}}, but not having been normalized by the {{{DateUtils.getGpxFormat()}}} formatter): 231 * or by converting {{{String}}} to {{{Date}}} first, i.e. {{{gpxFormat.format(DateUtils.fromString(p1.get(GpxConstants.PT_TIME)))}}} with no changes to current revision of {{{Waypoint.java}}} (i.e. PT_TIME attributes stored as {{{String}}}, but not having been normalized by the {{{DateUtils.getGpxFormat()}}} formatter). This means updates exclusively to fix the unit test in {{{OsmDataLayerTest.java}}}: 232 232 {{{ 233 233 #!diff … … 276 276 277 277 }}} 278 279 --------- 280 281 The last of the three diffs is probably what you had in mind with your request in comment:16, but be aware that code may write differently formatted strings out to GPX files, if it spares the conversion that the unit test does. It could simple 282 * {{{write(file, pX.get(GpxConstants.PT_TIME))}}} instead of doing 283 * {{{write(file, gpxFormat.format(DateUtils.fromString((String) pX.get(GpxConstants.PT_TIME))))}}} 284 which may lead to randomness in the date string format (e.g. one timestamp with .000 ms appendix, another without, yet another without timezone code and so on), of course depending on the source data. 285 286 My current favorite seems to be to rely on storing {{{Date}}} objects exclusively for the {{{GpxConstants.PT_TIME}}} attribute of class {{{WayPoint}}}. It seems to be the most memory efficient and should lead to uniform formatting of values in any case. 287


