Exemplo n.º 1
0
 public IntermediateTimes(string line, int offset)
 {
     if (line.Length - offset < 23)
     {
         throw new Exception($"Cannot construct a {this.GetType().ToString()} as the string supplied (length {line.Length}) minus the offset ({offset}) is not long enough (must be at least 23).");
     }
     Arrive       = new TimetableTime(line, offset);
     Depart       = new TimetableTime(line, offset + 5);
     Pass         = new TimetableTime(line, offset + 10);
     PublicArrive = new TimetableTime(line, offset + 15);
     PublicDepart = new TimetableTime(line, offset + 19);
 }
Exemplo n.º 2
0
        public static UInt32 TimeDiff(TimetableTime earlier, TimetableTime later)
        {
            UInt32 result;

            if (later._minutes < earlier._minutes)
            {
                result = (UInt32)(later._minutes + 24 * 60 - earlier._minutes);
            }
            else
            {
                result = (UInt32)(later._minutes - earlier._minutes);
            }
            return(result);
        }