def parse_gtfs_time(timestr):
    """
    GTFS time strings are HH:MM:SS (or H:MM:SS if the hours field is less than
    10). The time is relative to noon on a given day, and the hours field can
    go over 23 to represent a time on the following day (GTFS time never
    decreases in a given trip).

    This function is not quite that picky, but its behavior is undefined if
    it's given a string not following the specification.

    This function returns a timedelta, which contains the number of seconds
    since noon represented by a time on a given day.
    """
    split = timestr.split(':')
    seconds = int(split[-1])
    minutes = int(split[-2]) if len(split) > 1 else 0
    hours = int(split[-3]) if len(split) > 2 else 0
    return (hours - 12) * 3600 + minutes * 60 + seconds
dataset/ETHPy150Open spaceboats/busbus/busbus/provider/gtfs.py/parse_gtfs_time/original