From 8e41d0ae17fae6a0ff29e79c26f027d01de33759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20M=C3=A9a?= Date: Wed, 22 Apr 2026 14:05:18 -0400 Subject: [PATCH] TimeZone != TimeZoneId --- .../java/org/mtransit/parser/mt/GenerateMObjectsTask.java | 2 +- src/main/java/org/mtransit/parser/mt/MGenerator.java | 8 ++++---- src/main/java/org/mtransit/parser/mt/data/MAgency.kt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/mtransit/parser/mt/GenerateMObjectsTask.java b/src/main/java/org/mtransit/parser/mt/GenerateMObjectsTask.java index e6186fa6..dcdbf87d 100644 --- a/src/main/java/org/mtransit/parser/mt/GenerateMObjectsTask.java +++ b/src/main/java/org/mtransit/parser/mt/GenerateMObjectsTask.java @@ -251,7 +251,7 @@ private MSpec doCall() { && (lastDeparture < -1 || lastDeparture < lastFrequency.getEndTime())) { lastDeparture = lastFrequency.getEndTime(); } - DATE_TIME_FORMAT.setTimeZone(TimeZone.getTimeZone(mAgenciesList.get(0).getTimezone())); + DATE_TIME_FORMAT.setTimeZone(TimeZone.getTimeZone(mAgenciesList.get(0).getTimezoneId())); try { firstTimestamp = GFieldTypes.toTimeStamp(DATE_TIME_FORMAT, firstCalendarDate, firstDeparture); } catch (Exception e) { diff --git a/src/main/java/org/mtransit/parser/mt/MGenerator.java b/src/main/java/org/mtransit/parser/mt/MGenerator.java index c5cf7a64..2836b3e0 100644 --- a/src/main/java/org/mtransit/parser/mt/MGenerator.java +++ b/src/main/java/org/mtransit/parser/mt/MGenerator.java @@ -1103,7 +1103,7 @@ private static void dumpCommonValues(File dumpDirF, GAgencyTools gAgencyTools, M ow.write(getRESOURCES_INTEGER(GTFS_RDS_AGENCY_EXTENDED_TYPE, gAgencyTools.getAgencyExtendedRouteType())); ow.write(Constants.NEW_LINE); } - ow.write(getRESOURCES_STRING(GTFS_RDS_TIMEZONE, mSpec.getFirstAgency().getTimezone())); + ow.write(getRESOURCES_STRING(GTFS_RDS_TIMEZONE, mSpec.getFirstAgency().getTimezoneId())); ow.write(Constants.NEW_LINE); ow.write(getRESOURCES_STRING(GTFS_RDS_COLOR, mSpec.getFirstAgency().getColor())); ow.write(Constants.NEW_LINE); @@ -1193,7 +1193,7 @@ private static void dumpValues(File dumpDirF, String fileBase, MSpec mSpec, Doub ow.write(getRESOURCES_BOOL(fileBase + GTFS_RDS_FREQUENCY_AVAILABLE, mSpec.hasRouteFrequencies())); ow.write(Constants.NEW_LINE); if (StringUtils.isEmpty(fileBase)) { - ow.write(getRESOURCES_STRING(GTFS_RDS_TIMEZONE, mSpec.getFirstAgency().getTimezone())); + ow.write(getRESOURCES_STRING(GTFS_RDS_TIMEZONE, mSpec.getFirstAgency().getTimezoneId())); ow.write(Constants.NEW_LINE); } ow.write(getRESOURCES_STRING(fileBase + GTFS_RDS_AREA_MIN_LAT, minLat)); @@ -1226,9 +1226,9 @@ private static String getCommentedDateTime(int timestampInSec, @NotNull MSpec mS try { final DateFormat dateTimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z", Locale.ENGLISH); try { - dateTimeFormat.setTimeZone(TimeZone.getTimeZone(mSpec.getFirstAgency().getTimezone())); + dateTimeFormat.setTimeZone(TimeZone.getTimeZone(mSpec.getFirstAgency().getTimezoneId())); } catch (Exception e) { - MTLog.logNonFatal(e, "Error while setting time-zone for commented date time %s!", mSpec.getFirstAgency().getTimezone()); + MTLog.logNonFatal(e, "Error while setting time-zone for commented date time %s!", mSpec.getFirstAgency().getTimezoneId()); } final String formattedTime = dateTimeFormat.format(new Date(TimeUnit.SECONDS.toMillis(timestampInSec))); return ""; diff --git a/src/main/java/org/mtransit/parser/mt/data/MAgency.kt b/src/main/java/org/mtransit/parser/mt/data/MAgency.kt index b541adf4..59bcd4e2 100644 --- a/src/main/java/org/mtransit/parser/mt/data/MAgency.kt +++ b/src/main/java/org/mtransit/parser/mt/data/MAgency.kt @@ -11,7 +11,7 @@ data class MAgency( val idInt: Int, val name: String, val url: String, - val timezone: String, + val timezoneId: String, val color: String, val type: Int, ) : Comparable { @@ -49,7 +49,7 @@ data class MAgency( this.idInt != other.idInt -> this._id.compareTo(other._id) this.name != other.name -> this.name.compareTo(other.name) this.url != other.url -> this.url.compareTo(other.url) - this.timezone != other.timezone -> this.timezone.compareTo(other.timezone) + this.timezoneId != other.timezoneId -> this.timezoneId.compareTo(other.timezoneId) this.color != other.color -> this.color.compareTo(other.color) this.type != other.type -> this.type.compareTo(other.type) else -> 0