/// <summary> /// Adds onduty time for Onduty duration calculations /// </summary> /// <param name="duration">Duration of onduty time</param> internal void AddOnDutyTime(TimeSpan duration, bool includeWeekly = true) { if (includeWeekly) { DurationOnDutySinceLastWeeklyReset = DurationOnDutySinceLastWeeklyReset.Add(duration); } DurationOnDutySinceLastDailyReset = DurationOnDutySinceLastDailyReset.Add(duration); DurationOnDutySinceLastRestBreak = DurationOnDutySinceLastRestBreak.Add(duration); }
/// <summary> /// Gets the index of the event immediately after the 1st split sleeper to recalculate onduty, drive, and weekly time /// </summary> /// <returns>index of status immediately after 1st (minus one to account for i++ loop)</returns> internal int GetIndexToBackProcessTimeBetweenSplits() { SetDailyReset(FirstSleeperSplit.EndDateTime); //reset 70 to exclude main sleeper berth time (and time to reprocess) TimeSpan reprocessedDuration = SecondSleeperSplit.StartDateTime.Subtract(FirstSleeperSplit.EndDateTime); TimeSpan mainSleeperDuration = FirstSleeperSplit.IsMainSleeperSplit ? FirstSleeperSplit.Duration : SecondSleeperSplit.IsMainSleeperSplit ? SecondSleeperSplit.Duration : TimeSpan.FromDays(0); DurationOnDutySinceLastWeeklyReset = DurationOnDutySinceLastWeeklyReset.Subtract(mainSleeperDuration.Add(reprocessedDuration)); int i = RetroactiveIndex.Value - 1; ResetSplitSleeper(); return(i); }