Changeset 15343 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-09-09T23:22:13+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/rtklib/RtkLibPosReader.java
r15250 r15343 12 12 import java.util.Collection; 13 13 import java.util.Collections; 14 import java.util.Date; 14 15 import java.util.Locale; 15 16 import java.util.Objects; … … 49 50 private static final int IDX_RATIO = 14; 50 51 51 private final SimpleDateFormat dateTimeFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.ENGLISH); // 2019/06/08 08:23:15.000 52 private final SimpleDateFormat dateTimeFmtS = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH); // 2019/06/08 08:23:15 53 private final SimpleDateFormat dateTimeFmtL = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.ENGLISH); // 2019/06/08 08:23:15.000 52 54 53 55 private final InputStream source; … … 62 64 public RtkLibPosReader(InputStream source) throws IOException { 63 65 this.source = Objects.requireNonNull(source); 64 dateTimeFmt.setTimeZone(DateUtils.UTC); 66 dateTimeFmtS.setTimeZone(DateUtils.UTC); 67 dateTimeFmtL.setTimeZone(DateUtils.UTC); 68 } 69 70 private Date parseDate(String date) throws ParseException { 71 return (date.length() > 20 ? dateTimeFmtL : dateTimeFmtS).parse(date); 65 72 } 66 73 … … 84 91 Double.parseDouble(fields[IDX_LON]))); 85 92 currentwp.put(GpxConstants.PT_ELE, fields[IDX_HEIGHT]); 86 currentwp.setTime( dateTimeFmt.parse(fields[IDX_DATE]+" "+fields[IDX_TIME]));93 currentwp.setTime(parseDate(fields[IDX_DATE]+" "+fields[IDX_TIME])); 87 94 currentwp.put(GpxConstants.RTKLIB_Q, Integer.parseInt(fields[IDX_Q])); 88 95 currentwp.put(GpxConstants.PT_SAT, fields[IDX_NS]);
Note:
See TracChangeset
for help on using the changeset viewer.