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

Skip to content

Commit 475287b

Browse files
ris: gtfs-rt: refactor parse_time
1 parent 351fb86 commit 475287b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

modules/ris/include/motis/ris/gtfs-rt/parse_time.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ inline gtfs_trip_id to_trip_id(transit_realtime::TripDescriptor const& d,
3737

3838
inline unixtime get_updated_time(
3939
transit_realtime::TripUpdate_StopTimeEvent const& time_event,
40-
unixtime schedule_time, const bool is_addition_trip) {
41-
42-
unixtime updated_time = 0;
40+
unixtime const schedule_time, bool const is_addition_trip) {
4341
if (time_event.has_time() && !is_addition_trip) {
44-
updated_time = time_event.time();
42+
return time_event.time();
4543
} else if (time_event.has_delay() && schedule_time != 0) {
46-
updated_time = schedule_time + time_event.delay();
44+
return schedule_time + time_event.delay();
4745
} else {
4846
if (is_addition_trip) {
4947
throw std::runtime_error{
@@ -54,8 +52,6 @@ inline unixtime get_updated_time(
5452
"Neither absolute new time or schedule time and delay are given."};
5553
}
5654
}
57-
58-
return updated_time;
5955
};
6056

6157
inline unixtime get_schedule_time(trip const& trip, schedule const& sched,

0 commit comments

Comments
 (0)