mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 08:10:46 +00:00
Fix time parsing when binary querying connections
This commit is contained in:
parent
f28109c5aa
commit
abbd15b368
1 changed files with 11 additions and 3 deletions
|
@ -1782,7 +1782,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
final int numChanges = is.readShortReverse();
|
||||
|
||||
/* final long duration = */time(is, 0, 0);
|
||||
/* final long duration = time(is, 0, 0); */is.readShortReverse();
|
||||
|
||||
is.reset();
|
||||
is.skipBytes(serviceDaysTablePtr + serviceDaysTableOffset);
|
||||
|
@ -2148,12 +2148,20 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final int hours = value / 100;
|
||||
final int minutes = value % 100;
|
||||
|
||||
if (minutes < 0 || minutes > 60)
|
||||
throw new IllegalStateException("minutes out of range: " + minutes);
|
||||
|
||||
final Calendar time = new GregorianCalendar(timeZone());
|
||||
|
||||
time.setTimeInMillis(baseDate);
|
||||
time.add(Calendar.HOUR, hours);
|
||||
time.add(Calendar.MINUTE, minutes);
|
||||
if (time.get(Calendar.HOUR) != 0 || time.get(Calendar.MINUTE) != 0)
|
||||
throw new IllegalStateException("baseDate not on date boundary: " + baseDate);
|
||||
|
||||
time.add(Calendar.DAY_OF_YEAR, dayOffset);
|
||||
|
||||
time.set(Calendar.HOUR, hours);
|
||||
time.set(Calendar.MINUTE, minutes);
|
||||
|
||||
return time.getTimeInMillis();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue