Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 983633d

Browse files
committed
fallback to double for timestamps
1 parent 4541d80 commit 983633d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ protected double parseTimestamp(final JSONObject json, final String fieldName) {
109109
return date.getTime() / 1000.0;
110110
}
111111
} catch (final Exception ex) {
112+
// trying to parse field as double
113+
double d = json.optDouble(fieldName, Double.NaN);
114+
if (d != Double.NaN) {
115+
return d;
116+
}
112117
AbstractResultParser.LOG.info("Failed to parse time", ex);
113118
}
114119
return Double.NaN;

0 commit comments

Comments
 (0)