@Override
  public int compareTo(HiveIntervalDayTime other) {
    long cmp = this.totalSeconds - other.totalSeconds;
    if (cmp == 0) {
      cmp = this.nanos - other.nanos;
    }
    if (cmp != 0) {
      cmp = cmp > 0 ? 1 : -1;
    }
    return (int) cmp;
  }
Ensures that the seconds and nanoseconds fields have consistent sign
storage-api/src/java/org/apache/hadoop/hive/common/type/HiveIntervalDayTime.java