Index: /trunk/data_nodist/rtklib_example2.pos
===================================================================
--- /trunk/data_nodist/rtklib_example2.pos	(revision 15343)
+++ /trunk/data_nodist/rtklib_example2.pos	(revision 15343)
@@ -0,0 +1,27 @@
+% program   : RTKPOST ver.demo5 b29e
+% inp file  : ..\..\RINEX\2019\2050\0\igu20500_18.sp3
+% obs start : 2019/04/21 08:20:32.0 GPST (week2050  30032.0s)
+% obs end   : 2019/04/21 08:22:34.0 GPST (week2050  30154.0s)
+% pos mode  : kinematic
+% freqs     : L1
+% solution  : forward
+% elev mask : 15.0 deg
+% dynamics  : on
+% tidecorr  : off
+% ionos opt : broadcast
+% tropo opt : saastamoinen
+% ephemeris : precise
+% amb res   : fix and hold
+% val thres : 3.0
+% antenna1  :                       ( 0.0000  0.0000  0.0000)
+% antenna2  :                       ( 0.0000  0.0000  0.0000)
+% ref pos   : 54.330394848   48.402636321   219.1427
+%
+% (lat/lon/height=WGS84/ellipsoidal,Q=1:fix,2:float,3:sbas,4:dgps,5:single,6:ppp,ns=# of satellites)
+%  GPST               latitude(deg) longitude(deg)  height(m)   Q  ns   sdn(m)   sde(m)   sdu(m)  sdne(m)  sdeu(m)  sdun(m) age(s)  ratio
+2019/04/21 08:20:32   54.262930227   48.325420725   141.8619   2   4   3.5277   3.7156  17.2873   2.3856  -7.2184  -5.7246   2.00    0.0
+2019/04/21 08:20:32   54.262958214   48.325449059   143.0793   2   4   2.6540   2.8837  13.7886   1.9062  -5.7620  -4.5848   2.50    0.0
+2019/04/21 08:20:33   54.262986445   48.325467024   140.3774   2   5   1.6763   1.3406   5.2964  -0.5547  -1.6719  -0.2926   3.00    0.0
+2019/04/21 08:20:33   54.263015765   48.325492927   138.4168   2   4   1.4856   1.2305   5.0426  -0.3606  -1.7052  -0.7839   3.50    0.0
+2019/04/21 08:20:34   54.263041845   48.325512930   138.8902   2   4   1.3541   1.1540   4.8558  -0.1657  -1.7117  -0.9512   4.00    0.0
+2019/04/21 08:20:34   54.263066740   48.325531409   139.6451   2   6   1.1759   0.9257   3.4257  -0.4701  -1.0110   0.5915   4.50    0.0
Index: /trunk/src/org/openstreetmap/josm/io/rtklib/RtkLibPosReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/rtklib/RtkLibPosReader.java	(revision 15342)
+++ /trunk/src/org/openstreetmap/josm/io/rtklib/RtkLibPosReader.java	(revision 15343)
@@ -12,4 +12,5 @@
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Date;
 import java.util.Locale;
 import java.util.Objects;
@@ -49,5 +50,6 @@
     private static final int IDX_RATIO = 14;
 
-    private final SimpleDateFormat dateTimeFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.ENGLISH); // 2019/06/08 08:23:15.000
+    private final SimpleDateFormat dateTimeFmtS = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH); // 2019/06/08 08:23:15
+    private final SimpleDateFormat dateTimeFmtL = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.ENGLISH); // 2019/06/08 08:23:15.000
 
     private final InputStream source;
@@ -62,5 +64,10 @@
     public RtkLibPosReader(InputStream source) throws IOException {
         this.source = Objects.requireNonNull(source);
-        dateTimeFmt.setTimeZone(DateUtils.UTC);
+        dateTimeFmtS.setTimeZone(DateUtils.UTC);
+        dateTimeFmtL.setTimeZone(DateUtils.UTC);
+    }
+
+    private Date parseDate(String date) throws ParseException {
+        return (date.length() > 20 ? dateTimeFmtL : dateTimeFmtS).parse(date);
     }
 
@@ -84,5 +91,5 @@
                                     Double.parseDouble(fields[IDX_LON])));
                             currentwp.put(GpxConstants.PT_ELE, fields[IDX_HEIGHT]);
-                            currentwp.setTime(dateTimeFmt.parse(fields[IDX_DATE]+" "+fields[IDX_TIME]));
+                            currentwp.setTime(parseDate(fields[IDX_DATE]+" "+fields[IDX_TIME]));
                             currentwp.put(GpxConstants.RTKLIB_Q, Integer.parseInt(fields[IDX_Q]));
                             currentwp.put(GpxConstants.PT_SAT, fields[IDX_NS]);
Index: /trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java	(revision 15342)
+++ /trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java	(revision 15343)
@@ -4,4 +4,5 @@
 import static org.junit.Assert.assertEquals;
 
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -19,4 +20,5 @@
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.tools.date.DateUtils;
+import org.xml.sax.SAXException;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -43,4 +45,11 @@
     }
 
+    private static RtkLibPosReader read(String path) throws IOException, SAXException {
+        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
+        RtkLibPosReader in = new RtkLibPosReader(Files.newInputStream(Paths.get(path)));
+        in.parse(true);
+        return in;
+    }
+
     /**
      * Tests reading a RTKLib pos file.
@@ -49,7 +58,5 @@
     @Test
     public void testReader() throws Exception {
-        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
-        RtkLibPosReader in = new RtkLibPosReader(Files.newInputStream(Paths.get("data_nodist/rtklib_example.pos")));
-        in.parse(true);
+        RtkLibPosReader in = read("data_nodist/rtklib_example.pos");
         assertEquals(137, in.getNumberOfCoordinates());
 
@@ -70,3 +77,13 @@
         assertEquals("2.2090015", wayPoints.get(0).get(GpxConstants.PT_HDOP).toString().trim());
     }
+
+    /**
+     * Tests reading another RTKLib pos file with different date format.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testReader2() throws Exception {
+        RtkLibPosReader in = read("data_nodist/rtklib_example2.pos");
+        assertEquals(6, in.getNumberOfCoordinates());
+    }
 }
