forked from upstream-mirrors/OpenTracks
Minor initialization fixes
This commit is contained in:
@@ -46,7 +46,7 @@ import java.util.TimeZone;
|
||||
public class CsvTrackWriter implements TrackFormatWriter {
|
||||
static final SimpleDateFormat TIMESTAMP_FORMAT =
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
{
|
||||
static {
|
||||
TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ public class GpxImporter extends DefaultHandler {
|
||||
static final SimpleDateFormat DATE_FORMAT3 = new SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
||||
static final SimpleTimeZone UTC_TIMEZONE = new SimpleTimeZone(0, "UTC");
|
||||
static {
|
||||
DATE_FORMAT1.setTimeZone(UTC_TIMEZONE);
|
||||
DATE_FORMAT2.setTimeZone(UTC_TIMEZONE);
|
||||
DATE_FORMAT3.setTimeZone(UTC_TIMEZONE);
|
||||
}
|
||||
|
||||
/*
|
||||
* GPX-XML tag names and attributes.
|
||||
@@ -536,10 +541,8 @@ public class GpxImporter extends DefaultHandler {
|
||||
throw new SAXException(msg);
|
||||
}
|
||||
|
||||
private long parseTime(String timeContents, SimpleDateFormat formatParam) {
|
||||
SimpleDateFormat format = formatParam;
|
||||
private long parseTime(String timeContents, SimpleDateFormat format) {
|
||||
try {
|
||||
format.setTimeZone(UTC_TIMEZONE);
|
||||
return format.parse(timeContents).getTime();
|
||||
} catch (ParseException ex) {
|
||||
return -1;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GpxTrackWriter implements TrackFormatWriter {
|
||||
|
||||
static final SimpleDateFormat TIMESTAMP_FORMAT =
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
{
|
||||
static {
|
||||
TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user