durationDiff method

int durationDiff(
  1. TimeOfDay other,
  2. int duration
)

Implementation

int durationDiff(TimeOfDay other, int duration) {
  if (this.hour < other.hour &&
      (other.minute - this.minute).abs() == duration) return -1;
  if (this.hour > other.hour &&
      (this.minute - other.minute).abs() == duration) return 1;
  return 0;
}